mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 11:53:48 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7886fb6c4 | ||
|
|
82b1649f2e |
@@ -7,7 +7,10 @@
|
|||||||
in an unordered list. The format is:
|
in an unordered list. The format is:
|
||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
|
#### 6.4
|
||||||
|
- **.0**: Allow use of function references as callbacks (HiPhish) [#1067](https://github.com/scrooloose/nerdtree/pull/1067)
|
||||||
|
#### 6.3
|
||||||
|
- **.0**: Add new command that behaves like NERDTreeToggle but defaults to the root of a VCS repository. (willfindlay) [#1060](https://github.com/scrooloose/nerdtree/pull/1060)
|
||||||
#### 6.2
|
#### 6.2
|
||||||
- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056)
|
- **.1**: Menu option, 'copy path to clipboard' is aware of VIM clipboard option (jhzn) [#1056](https://github.com/scrooloose/nerdtree/pull/1056)
|
||||||
- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032)
|
- **.0**: Support tab-specific CWDs (PhilRunninger) [#1032](https://github.com/scrooloose/nerdtree/pull/1032)
|
||||||
|
|||||||
@@ -125,6 +125,14 @@ The following features and functionality are provided by the NERDTree:
|
|||||||
again. If no NERDTree exists for this tab then this command acts the
|
again. If no NERDTree exists for this tab then this command acts the
|
||||||
same as the |:NERDTree| command.
|
same as the |:NERDTree| command.
|
||||||
|
|
||||||
|
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
|
||||||
|
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
|
||||||
|
the version control system repository, and roots the NERDTree there. It
|
||||||
|
works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
|
||||||
|
couple of examples: >
|
||||||
|
:NERDTreeToggleVCS /home/marty/nerdtree/doc (opens /home/marty/nerdtree)
|
||||||
|
:NERDTreeToggleVCS (opens root of repository containing CWD)
|
||||||
|
|
||||||
:NERDTreeFocus *:NERDTreeFocus*
|
:NERDTreeFocus *:NERDTreeFocus*
|
||||||
Opens (or reopens) the NERDTree if it is not currently visible;
|
Opens (or reopens) the NERDTree if it is not currently visible;
|
||||||
otherwise, the cursor is moved to the already-open NERDTree.
|
otherwise, the cursor is moved to the already-open NERDTree.
|
||||||
@@ -1307,6 +1315,10 @@ following code conventions are used:
|
|||||||
See this blog post for more details:
|
See this blog post for more details:
|
||||||
http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
|
http://got-ravings.blogspot.com/2008/09/vim-pr0n-prototype-based-objects.html
|
||||||
|
|
||||||
|
A number of API functions take a callback argument to call. The callback can
|
||||||
|
be either a string with the name of a function to call, or a |Funcref| object
|
||||||
|
which will be called directly.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.1. Key map API *NERDTreeKeymapAPI*
|
4.1. Key map API *NERDTreeKeymapAPI*
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ endfunction
|
|||||||
"FUNCTION: KeyMap.invoke() {{{1
|
"FUNCTION: KeyMap.invoke() {{{1
|
||||||
"Call the KeyMaps callback function
|
"Call the KeyMaps callback function
|
||||||
function! s:KeyMap.invoke(...)
|
function! s:KeyMap.invoke(...)
|
||||||
let Callback = function(self.callback)
|
let Callback = type(self.callback) == v:t_func ? self.callback : function(self.callback)
|
||||||
if a:0
|
if a:0
|
||||||
call Callback(a:1)
|
call Callback(a:1)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ endfunction
|
|||||||
"specified
|
"specified
|
||||||
function! s:MenuItem.enabled()
|
function! s:MenuItem.enabled()
|
||||||
if self.isActiveCallback != -1
|
if self.isActiveCallback != -1
|
||||||
return {self.isActiveCallback}()
|
return type(self.isActiveCallback) == v:t_func ? self.isActiveCallback() : {self.isActiveCallback}()
|
||||||
endif
|
endif
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
@@ -94,7 +94,11 @@ function! s:MenuItem.execute()
|
|||||||
call mc.showMenu()
|
call mc.showMenu()
|
||||||
else
|
else
|
||||||
if self.callback != -1
|
if self.callback != -1
|
||||||
call {self.callback}()
|
if type(self.callback) == v:t_func
|
||||||
|
call self.callback()
|
||||||
|
else
|
||||||
|
call {self.callback}()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -14,8 +14,9 @@ endfunction
|
|||||||
function! s:Notifier.NotifyListeners(event, path, nerdtree, params)
|
function! s:Notifier.NotifyListeners(event, path, nerdtree, params)
|
||||||
let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
|
let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
|
||||||
|
|
||||||
for listener in s:Notifier.GetListenersForEvent(a:event)
|
for Listener in s:Notifier.GetListenersForEvent(a:event)
|
||||||
call {listener}(event)
|
let Callback = type(Listener) == v:t_func ? Listener : function(Listener)
|
||||||
|
call Callback(event)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -500,8 +500,9 @@ function! s:Path.ignore(nerdtree)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
for callback in g:NERDTree.PathFilters()
|
for Callback in g:NERDTree.PathFilters()
|
||||||
if {callback}({'path': self, 'nerdtree': a:nerdtree})
|
let Callback = type(Callback) == v:t_func ? Callback : function(Callback)
|
||||||
|
if Callback({'path': self, 'nerdtree': a:nerdtree})
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"
|
"
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
|
command! -n=? -complete=dir -bar NERDTreeVCS :call <SID>CreateTabTreeVCS('<args>')
|
||||||
|
command! -n=? -complete=dir -bar NERDTreeToggleVCS :call <SID>ToggleTabTreeVCS('<args>')
|
||||||
|
|
||||||
" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
|
" FUNCTION: s:CreateTabTreeVCS(a:name) {{{1
|
||||||
function! s:CreateTabTreeVCS(name)
|
function! s:CreateTabTreeVCS(name)
|
||||||
@@ -19,6 +20,14 @@ function! s:CreateTabTreeVCS(name)
|
|||||||
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
|
call g:NERDTreeCreator.createTabTree(empty(l:path) ? "" : l:path._str())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:ToggleTabTreeVCS(a:name) {{{1
|
||||||
|
" Behaves the same as ToggleTabTree except roots directory at VCS root
|
||||||
|
function! s:ToggleTabTreeVCS(name)
|
||||||
|
let l:path = g:NERDTreeCreator._pathForString(a:name)
|
||||||
|
let l:path = s:FindParentVCSRoot(l:path)
|
||||||
|
call g:NERDTreeCreator.toggleTabTree(empty(l:path) ? "" : l:path._str())
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
|
" FUNCTION: s:FindParentVCSRoot(a:path) {{{1
|
||||||
" Finds the root version control system folder of the given path. If a:path is
|
" Finds the root version control system folder of the given path. If a:path is
|
||||||
" not part of a repository, return the original path.
|
" not part of a repository, return the original path.
|
||||||
|
|||||||
Reference in New Issue
Block a user