mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 03:43:50 -05:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a9d533f3d | ||
|
|
d3f9fc44ca | ||
|
|
1d46d6df3e | ||
|
|
593c16add3 | ||
|
|
d3becd1149 | ||
|
|
1b19089917 | ||
|
|
c8be9458dd | ||
|
|
628098fff1 | ||
|
|
b134f6518b |
@@ -4,6 +4,14 @@
|
|||||||
version in an unordered list. The format is:
|
version 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.10
|
||||||
|
- **.6**: Restore the default behavior of the <CR> key. (PhilRunninger) [#1221](https://github.com/preservim/nerdtree/pull/1221)
|
||||||
|
- **.5**: Fix `{'keepopen':0}` in NERDTreeCustomOpenArgs (PhilRunninger) [#1217](https://github.com/preservim/nerdtree/pull/1217)
|
||||||
|
- **.4**: Removed directory separator from sort key (Daniel E) [#1219](https://github.com/preservim/nerdtree/pull/1219)
|
||||||
|
- **.3**: Add new FAQ and answer: How to prevent buffers replacing NERDTree. (PhilRunninger) [#1215](https://github.com/preservim/nerdtree/pull/1215)
|
||||||
|
- **.2**: New menu command: Run a system command in this directory. (PhilRunninger) [#1214](https://github.com/preservim/nerdtree/pull/1214)
|
||||||
|
- **.1**: Escape quotation marks so they can be used in key mappings. (PhilRunninger) [#1213](https://github.com/preservim/nerdtree/pull/1213)
|
||||||
|
- **.0**: Enable full path specifications for NERDTreeIgnore (PhilRunninger) [#1207](https://github.com/preservim/nerdtree/pull/1207)
|
||||||
#### 6.9
|
#### 6.9
|
||||||
- **.12**: Respect NERDTreeCustomOpenArgs when opening bookmark (przepompownia) [#1200](https://github.com/preservim/nerdtree/pull/1200)
|
- **.12**: Respect NERDTreeCustomOpenArgs when opening bookmark (przepompownia) [#1200](https://github.com/preservim/nerdtree/pull/1200)
|
||||||
- **.11**: Revamp the README. (buncis, PhilRunninger) [#1192](https://github.com/preservim/nerdtree/pull/1192), [#1193](https://github.com/preservim/nerdtree/pull/1193)
|
- **.11**: Revamp the README. (buncis, PhilRunninger) [#1192](https://github.com/preservim/nerdtree/pull/1192), [#1193](https://github.com/preservim/nerdtree/pull/1193)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ The NERDTree is a file system explorer for the Vim editor. Using this plugin, us
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Use your favorite plugin manager to install this plugin. [tpope/vim-pathogen](https://github.com/tpope/vim-pathogen), [VundleVimVundle.vim](https://github.com/VundleVim/Vundle.vim), [junegunnvim-plug](https://github.com/junegunn/vim-plug), and [Shougo/dein.vim](https://github.com/Shougo/dein.vim) are some of the more popular ones. A lengthy discussion of these and other managers can be found on [vi.stackexchange.com](https://vi.stackexchange.com/questions/388/what-is-the-difference-between-the-vim-plugin-managers). Basic instructions are provided below, but please **be sure to read, understand, and follow all the safety rules that come with your ~~power tools~~ plugin manager.**
|
Use your favorite plugin manager to install this plugin. [tpope/vim-pathogen](https://github.com/tpope/vim-pathogen), [VundleVim/Vundle.vim](https://github.com/VundleVim/Vundle.vim), [junegunn/vim-plug](https://github.com/junegunn/vim-plug), and [Shougo/dein.vim](https://github.com/Shougo/dein.vim) are some of the more popular ones. A lengthy discussion of these and other managers can be found on [vi.stackexchange.com](https://vi.stackexchange.com/questions/388/what-is-the-difference-between-the-vim-plugin-managers). Basic instructions are provided below, but please **be sure to read, understand, and follow all the safety rules that come with your ~~power tools~~ plugin manager.**
|
||||||
|
|
||||||
If you have no favorite, or want to manage your plugins without 3rd-party dependencies, consider using Vim 8+ packages, as described in Greg Hurrell's excellent Youtube video: [Vim screencast #75: Plugin managers](https://www.youtube.com/watch?v=X2_R3uxDN6g).
|
If you have no favorite, or want to manage your plugins without 3rd-party dependencies, consider using Vim 8+ packages, as described in Greg Hurrell's excellent Youtube video: [Vim screencast #75: Plugin managers](https://www.youtube.com/watch?v=X2_R3uxDN6g).
|
||||||
|
|
||||||
@@ -156,6 +156,14 @@ autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTr
|
|||||||
\ quit | endif
|
\ quit | endif
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### How can I prevent other buffers replacing NERDTree in its window?
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
|
||||||
|
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
|
||||||
|
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
|
||||||
|
```
|
||||||
|
|
||||||
### Can I have the same NERDTree on every tab automatically?
|
### Can I have the same NERDTree on every tab automatically?
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
@@ -175,4 +183,3 @@ let g:NERDTreeDirArrowExpandable = '▸'
|
|||||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||||
```
|
```
|
||||||
The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details.
|
The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details.
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,16 @@ endfunction
|
|||||||
" SECTION: General Functions {{{1
|
" SECTION: General Functions {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
|
|
||||||
|
" FUNCTION: nerdtree#closeTreeOnOpen() {{{2
|
||||||
|
function! nerdtree#closeTreeOnOpen() abort
|
||||||
|
return g:NERDTreeQuitOnOpen == 1 || g:NERDTreeQuitOnOpen == 3
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: nerdtree#closeBookmarksOnOpen() {{{2
|
||||||
|
function! nerdtree#closeBookmarksOnOpen() abort
|
||||||
|
return g:NERDTreeQuitOnOpen == 2 || g:NERDTreeQuitOnOpen == 3
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: nerdtree#slash() {{{2
|
" FUNCTION: nerdtree#slash() {{{2
|
||||||
" Return the path separator used by the underlying file system. Special
|
" Return the path separator used by the underlying file system. Special
|
||||||
" consideration is taken for the use of the 'shellslash' option on Windows
|
" consideration is taken for the use of the 'shellslash' option on Windows
|
||||||
@@ -46,28 +56,6 @@ function! nerdtree#slash() abort
|
|||||||
return '/'
|
return '/'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: nerdtree#and(x,y) {{{2
|
|
||||||
" Implements and() function for Vim <= 7.4
|
|
||||||
function! nerdtree#and(x,y) abort
|
|
||||||
if exists('*and')
|
|
||||||
return and(a:x, a:y)
|
|
||||||
else
|
|
||||||
let l:x = a:x
|
|
||||||
let l:y = a:y
|
|
||||||
let l:n = 0
|
|
||||||
let l:result = 0
|
|
||||||
while l:x > 0 && l:y > 0
|
|
||||||
if (l:x % 2) && (l:y % 2)
|
|
||||||
let l:result += float2nr(pow(2, l:n))
|
|
||||||
endif
|
|
||||||
let l:x = float2nr(l:x / 2)
|
|
||||||
let l:y = float2nr(l:y / 2)
|
|
||||||
let l:n += 1
|
|
||||||
endwhile
|
|
||||||
return l:result
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
|
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
|
||||||
"inits a window tree in the current buffer if appropriate
|
"inits a window tree in the current buffer if appropriate
|
||||||
function! nerdtree#checkForBrowse(dir) abort
|
function! nerdtree#checkForBrowse(dir) abort
|
||||||
|
|||||||
@@ -109,40 +109,16 @@ endfunction
|
|||||||
|
|
||||||
"FUNCTION: s:initCustomOpenArgs() {{{1
|
"FUNCTION: s:initCustomOpenArgs() {{{1
|
||||||
function! s:initCustomOpenArgs() abort
|
function! s:initCustomOpenArgs() abort
|
||||||
let l:defaultOpenArgs = {'file': {'reuse': 'all', 'where': 'p'}, 'dir': {}}
|
let l:defaultOpenArgs = {'file': {'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()}, 'dir': {}}
|
||||||
let l:customOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
|
try
|
||||||
|
let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
|
||||||
if !s:validateType(l:customOpenArgs, type({})) || empty(l:customOpenArgs)
|
call extend(g:NERDTreeCustomOpenArgs, l:defaultOpenArgs, 'keep')
|
||||||
let g:NERDTreeCustomOpenArgs = l:customOpenArgs
|
catch /^Vim(\a\+):E712:/
|
||||||
return l:defaultOpenArgs
|
call nerdtree#echoWarning('g:NERDTreeCustomOpenArgs is not set properly. Using default value.')
|
||||||
endif
|
let g:NERDTreeCustomOpenArgs = l:defaultOpenArgs
|
||||||
|
finally
|
||||||
for l:typeKey in keys(l:defaultOpenArgs)
|
return g:NERDTreeCustomOpenArgs
|
||||||
if !s:validateType(get(l:customOpenArgs, l:typeKey, {}), type({}))
|
endtry
|
||||||
\ || !has_key(l:customOpenArgs, l:typeKey)
|
|
||||||
let l:customOpenArgs[l:typeKey] = l:defaultOpenArgs[l:typeKey]
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
for l:optionName in keys(l:defaultOpenArgs[l:typeKey])
|
|
||||||
if s:validateType(get(l:customOpenArgs[l:typeKey], l:optionName, v:null), type(''))
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
let l:customOpenArgs[l:typeKey][l:optionName] = l:defaultOpenArgs[l:typeKey][l:optionName]
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
|
|
||||||
let g:NERDTreeCustomOpenArgs = l:customOpenArgs
|
|
||||||
|
|
||||||
return extend(l:customOpenArgs, l:defaultOpenArgs, 'keep')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:validateType(variable, type) abort
|
|
||||||
if type(a:variable) == a:type
|
|
||||||
return v:true
|
|
||||||
endif
|
|
||||||
|
|
||||||
return v:false
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:activateAll() {{{1
|
"FUNCTION: s:activateAll() {{{1
|
||||||
@@ -168,13 +144,13 @@ endfunction
|
|||||||
"FUNCTION: s:activateFileNode() {{{1
|
"FUNCTION: s:activateFileNode() {{{1
|
||||||
"handle the user activating a tree node
|
"handle the user activating a tree node
|
||||||
function! s:activateFileNode(node) abort
|
function! s:activateFileNode(node) abort
|
||||||
call a:node.activate({'reuse': 'all', 'where': 'p'})
|
call a:node.activate({'reuse': 'all', 'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:activateBookmark(bookmark) {{{1
|
"FUNCTION: s:activateBookmark(bookmark) {{{1
|
||||||
"handle the user activating a bookmark
|
"handle the user activating a bookmark
|
||||||
function! s:activateBookmark(bm) abort
|
function! s:activateBookmark(bm) abort
|
||||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {})
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
|
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
|
||||||
@@ -539,24 +515,24 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:openHSplit(target) {{{1
|
" FUNCTION: s:openHSplit(target) {{{1
|
||||||
function! s:openHSplit(target) abort
|
function! s:openHSplit(target) abort
|
||||||
call a:target.activate({'where': 'h'})
|
call a:target.activate({'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:openVSplit(target) {{{1
|
" FUNCTION: s:openVSplit(target) {{{1
|
||||||
function! s:openVSplit(target) abort
|
function! s:openVSplit(target) abort
|
||||||
call a:target.activate({'where': 'v'})
|
call a:target.activate({'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:openHSplitBookmark(bookmark) {{{1
|
"FUNCTION: s:openHSplitBookmark(bookmark) {{{1
|
||||||
"handle the user activating a bookmark
|
"handle the user activating a bookmark
|
||||||
function! s:openHSplitBookmark(bm) abort
|
function! s:openHSplitBookmark(bm) abort
|
||||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h'} : {})
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:openVSplitBookmark(bookmark) {{{1
|
"FUNCTION: s:openVSplitBookmark(bookmark) {{{1
|
||||||
"handle the user activating a bookmark
|
"handle the user activating a bookmark
|
||||||
function! s:openVSplitBookmark(bm) abort
|
function! s:openVSplitBookmark(bm) abort
|
||||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v'} : {})
|
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
|
" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
|
||||||
@@ -576,13 +552,13 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:openInNewTab(target) {{{1
|
" FUNCTION: s:openInNewTab(target) {{{1
|
||||||
function! s:openInNewTab(target) abort
|
function! s:openInNewTab(target) abort
|
||||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'})
|
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||||
call l:opener.open(a:target)
|
call l:opener.open(a:target)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:openInNewTabSilent(target) {{{1
|
" FUNCTION: s:openInNewTabSilent(target) {{{1
|
||||||
function! s:openInNewTabSilent(target) abort
|
function! s:openInNewTabSilent(target) abort
|
||||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1})
|
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen(), 'stay': 1})
|
||||||
call l:opener.open(a:target)
|
call l:opener.open(a:target)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -596,7 +572,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
||||||
function! s:previewBookmark(bookmark) abort
|
function! s:previewBookmark(bookmark) abort
|
||||||
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'p', 'keepopen': 1} : {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
||||||
@@ -621,7 +597,7 @@ function! nerdtree#ui_glue#revealBookmark(name) abort
|
|||||||
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
|
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
|
||||||
call targetNode.putCursorHere(0, 1)
|
call targetNode.putCursorHere(0, 1)
|
||||||
catch /^NERDTree.BookmarkNotFoundError/
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
call nerdtree#echo('Bookmark isnt cached under the current root')
|
call nerdtree#echo('Bookmark isn''t cached under the current root')
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ The following features and functionality are provided by the NERDTree:
|
|||||||
:NERDTreeVCS (opens root of repository containing CWD)
|
:NERDTreeVCS (opens root of repository containing CWD)
|
||||||
<
|
<
|
||||||
:NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
|
:NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
|
||||||
Opens a fresh NERDTree with the root initialized to the dir for
|
Opens a fresh NERDTree with the root initialized to the directory for
|
||||||
<bookmark>. The only reason to use this command over :NERDTree is for
|
<bookmark>. The only reason to use this command over :NERDTree is for
|
||||||
the completion (which is for bookmarks rather than directories).
|
the completion (which is for bookmarks rather than directories).
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ The following features and functionality are provided by the NERDTree:
|
|||||||
is set to that path. If no NERDTree exists for this tab then this command
|
is set to that path. If no NERDTree exists for this tab then this command
|
||||||
acts the same as the |:NERDTree| command.
|
acts the same as the |:NERDTree| command.
|
||||||
|
|
||||||
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
|
:NERDTreeToggleVCS [<start-directory> | <bookmark>] *:NERDTreeToggleVCS*
|
||||||
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
|
Like |:NERDTreeToggle|, but searches up the directory tree to find the top of
|
||||||
the version control system repository, and roots the NERDTree there. It
|
the version control system repository, and roots the NERDTree there. It
|
||||||
works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
|
works with Git, Subversion, Mercurial, Bazaar, and Darcs repositories. A
|
||||||
@@ -249,7 +249,7 @@ Key Description help-tag~
|
|||||||
|
|
||||||
o........Open files, directories and bookmarks......................|NERDTree-o|
|
o........Open files, directories and bookmarks......................|NERDTree-o|
|
||||||
go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go|
|
go.......Open selected file, but leave cursor in the NERDTree......|NERDTree-go|
|
||||||
Open selected bookmark dir in current NERDTree
|
Open selected bookmark directory in current NERDTree
|
||||||
t........Open selected node/bookmark in a new tab...................|NERDTree-t|
|
t........Open selected node/bookmark in a new tab...................|NERDTree-t|
|
||||||
T........Same as 't' but keep the focus on the current tab..........|NERDTree-T|
|
T........Same as 't' but keep the focus on the current tab..........|NERDTree-T|
|
||||||
i........Open selected file in a split window.......................|NERDTree-i|
|
i........Open selected file in a split window.......................|NERDTree-i|
|
||||||
@@ -260,10 +260,10 @@ gs.......Same as s, but leave the cursor on the NERDTree...........|NERDTree-gs|
|
|||||||
O........Recursively open the selected directory....................|NERDTree-O|
|
O........Recursively open the selected directory....................|NERDTree-O|
|
||||||
x........Close the current nodes parent.............................|NERDTree-x|
|
x........Close the current nodes parent.............................|NERDTree-x|
|
||||||
X........Recursively close all children of the current node.........|NERDTree-X|
|
X........Recursively close all children of the current node.........|NERDTree-X|
|
||||||
e........Edit the current dir.......................................|NERDTree-e|
|
e........Edit the current directory.................................|NERDTree-e|
|
||||||
|
|
||||||
double-click....same as |NERDTree-o|.
|
double-click....same as |NERDTree-o|.
|
||||||
middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for dirs.
|
middle-click....same as |NERDTree-i| for files, and |NERDTree-e| for directories.
|
||||||
|
|
||||||
D........Delete the current bookmark ...............................|NERDTree-D|
|
D........Delete the current bookmark ...............................|NERDTree-D|
|
||||||
|
|
||||||
@@ -274,13 +274,13 @@ J........Jump down inside directories at the current tree depth.....|NERDTree-J|
|
|||||||
<C-J>....Jump down to next sibling of the current directory.......|NERDTree-C-J|
|
<C-J>....Jump down to next sibling of the current directory.......|NERDTree-C-J|
|
||||||
<C-K>....Jump up to previous sibling of the current directory.....|NERDTree-C-K|
|
<C-K>....Jump up to previous sibling of the current directory.....|NERDTree-C-K|
|
||||||
|
|
||||||
C........Change the tree root to the selected dir...................|NERDTree-C|
|
C........Change the tree root to the selected directory.............|NERDTree-C|
|
||||||
u........Move the tree root up one directory........................|NERDTree-u|
|
u........Move the tree root up one directory........................|NERDTree-u|
|
||||||
U........Same as 'u' except the old root node is left open..........|NERDTree-U|
|
U........Same as 'u' except the old root node is left open..........|NERDTree-U|
|
||||||
r........Recursively refresh the current directory..................|NERDTree-r|
|
r........Recursively refresh the current directory..................|NERDTree-r|
|
||||||
R........Recursively refresh the current root.......................|NERDTree-R|
|
R........Recursively refresh the current root.......................|NERDTree-R|
|
||||||
m........Display the NERDTree menu..................................|NERDTree-m|
|
m........Display the NERDTree menu..................................|NERDTree-m|
|
||||||
cd.......Change the CWD to the dir of the selected node............|NERDTree-cd|
|
cd.......Change the CWD to the directory of the selected node......|NERDTree-cd|
|
||||||
CD.......Change tree root to the CWD...............................|NERDTree-CD|
|
CD.......Change tree root to the CWD...............................|NERDTree-CD|
|
||||||
|
|
||||||
I........Toggle whether hidden files displayed......................|NERDTree-I|
|
I........Toggle whether hidden files displayed......................|NERDTree-I|
|
||||||
@@ -469,7 +469,7 @@ Jump to the first child of the current nodes parent.
|
|||||||
|
|
||||||
If the cursor is already on the first node then do the following:
|
If the cursor is already on the first node then do the following:
|
||||||
* loop back thru the siblings of the current nodes parent until we find an
|
* loop back thru the siblings of the current nodes parent until we find an
|
||||||
open dir with children
|
open directory with children
|
||||||
* go to the first child of that node
|
* go to the first child of that node
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -482,7 +482,7 @@ Jump to the last child of the current nodes parent.
|
|||||||
|
|
||||||
If the cursor is already on the last node then do the following:
|
If the cursor is already on the last node then do the following:
|
||||||
* loop forward thru the siblings of the current nodes parent until we find
|
* loop forward thru the siblings of the current nodes parent until we find
|
||||||
an open dir with children
|
an open directory with children
|
||||||
* go to the last child of that node
|
* go to the last child of that node
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -516,7 +516,7 @@ Default key: u
|
|||||||
Map setting: *NERDTreeMapUpdir*
|
Map setting: *NERDTreeMapUpdir*
|
||||||
Applies to: no restrictions.
|
Applies to: no restrictions.
|
||||||
|
|
||||||
Move the tree root up a dir (like doing a "cd ..").
|
Move the tree root up a directory (like doing a "cd ..").
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-U*
|
*NERDTree-U*
|
||||||
@@ -532,8 +532,8 @@ Default key: r
|
|||||||
Map setting: *NERDTreeMapRefresh*
|
Map setting: *NERDTreeMapRefresh*
|
||||||
Applies to: files and directories.
|
Applies to: files and directories.
|
||||||
|
|
||||||
If a dir is selected, recursively refresh that dir, i.e. scan the filesystem
|
If a directory is selected, recursively refresh that directory, i.e. scan the
|
||||||
for changes and represent them in the tree.
|
filesystem for changes and represent them in the tree.
|
||||||
|
|
||||||
If a file node is selected then the above is done on it's parent.
|
If a file node is selected then the above is done on it's parent.
|
||||||
|
|
||||||
@@ -634,8 +634,8 @@ file explorers have.
|
|||||||
|
|
||||||
The script comes with two default menu plugins: exec_menuitem.vim and
|
The script comes with two default menu plugins: exec_menuitem.vim and
|
||||||
fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
|
fs_menu.vim. fs_menu.vim adds some basic filesystem operations to the menu for
|
||||||
creating/deleting/moving/copying files and dirs. exec_menuitem.vim provides a
|
creating/deleting/moving/copying files and directories. exec_menuitem.vim
|
||||||
menu item to execute executable files.
|
provides a menu item to execute executable files.
|
||||||
|
|
||||||
Related tags: |NERDTree-m| |NERDTreeApi|
|
Related tags: |NERDTree-m| |NERDTreeApi|
|
||||||
|
|
||||||
@@ -921,7 +921,7 @@ Default: ['\~$'].
|
|||||||
|
|
||||||
This setting is used to specify which files the NERDTree should ignore. It
|
This setting is used to specify which files the NERDTree should ignore. It
|
||||||
must be a list of regular expressions. When the NERDTree is rendered, any
|
must be a list of regular expressions. When the NERDTree is rendered, any
|
||||||
files/dirs that match any of the regex's in NERDTreeIgnore won't be
|
files/directories that match any of the regex's in NERDTreeIgnore won't be
|
||||||
displayed.
|
displayed.
|
||||||
|
|
||||||
For example if you put the following line in your vimrc: >
|
For example if you put the following line in your vimrc: >
|
||||||
@@ -929,13 +929,18 @@ For example if you put the following line in your vimrc: >
|
|||||||
<
|
<
|
||||||
then all files ending in .vim or ~ will be ignored.
|
then all files ending in .vim or ~ will be ignored.
|
||||||
|
|
||||||
There are 2 magic flags that can be appended to the end of each regular
|
There are 3 magic flags that can be appended to the end of each regular
|
||||||
expression to specify that the regex should match only files or only dirs.
|
expression to specify that the regex should match only filenames, only lowest
|
||||||
These flags are "[[dir]]" and "[[file]]". Example: >
|
level directories, or a full path. These flags are "[[dir]]", "[[file]]", and
|
||||||
let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]']
|
"[[path]]". Example: >
|
||||||
|
let NERDTreeIgnore=['\.d$[[dir]]', '\.o$[[file]]', 'tmp/cache$[[path]]']
|
||||||
<
|
<
|
||||||
This will cause all dirs ending in ".d" to be ignored and all files ending in
|
This will cause all directories ending in ".d" to be ignored, all files ending
|
||||||
".o" to be ignored.
|
in ".o" to be ignored, and the "cache" subdirectory of any "tmp" directory to
|
||||||
|
be ignored. All other "cache" directories will be displayed.
|
||||||
|
|
||||||
|
When using the "[[path]]" tag on Windows, make sure you use escaped
|
||||||
|
backslashes for the separators in the regex, eg. 'Temp\\cache$[[path]]'
|
||||||
|
|
||||||
Note: to tell the NERDTree not to ignore any files you must use the following
|
Note: to tell the NERDTree not to ignore any files you must use the following
|
||||||
line: >
|
line: >
|
||||||
@@ -1099,8 +1104,8 @@ Examples: >
|
|||||||
<
|
<
|
||||||
1. Directories will appear last, everything else will appear above.
|
1. Directories will appear last, everything else will appear above.
|
||||||
2. Everything will simply appear in alphabetical order.
|
2. Everything will simply appear in alphabetical order.
|
||||||
3. Dirs will appear first, then ruby and php. Swap files, bak files and vim
|
3. Directories will appear first, then ruby and php. Swap files, bak files
|
||||||
backup files will appear last with everything else preceding them.
|
and vim backup files will appear last with everything else preceding them.
|
||||||
4. Everything is sorted by size, largest to smallest, with directories
|
4. Everything is sorted by size, largest to smallest, with directories
|
||||||
considered to have size 0 bytes.
|
considered to have size 0 bytes.
|
||||||
5. Directories will appear first alphabetically, followed by files, sorted by
|
5. Directories will appear first alphabetically, followed by files, sorted by
|
||||||
@@ -1174,8 +1179,9 @@ Use one of the following lines for this setting: >
|
|||||||
Values: 0 or 1
|
Values: 0 or 1
|
||||||
Default: 1.
|
Default: 1.
|
||||||
|
|
||||||
When displaying dir nodes, this setting tells NERDTree to collapse dirs that
|
When displaying directory nodes, this setting tells NERDTree to collapse
|
||||||
have only one child. Use one of the following lines for this setting: >
|
directories that have only one child. Use one of the following lines for this
|
||||||
|
setting: >
|
||||||
let NERDTreeCascadeSingleChildDir=0
|
let NERDTreeCascadeSingleChildDir=0
|
||||||
let NERDTreeCascadeSingleChildDir=1
|
let NERDTreeCascadeSingleChildDir=1
|
||||||
<
|
<
|
||||||
@@ -1184,11 +1190,12 @@ have only one child. Use one of the following lines for this setting: >
|
|||||||
Values: 0 or 1
|
Values: 0 or 1
|
||||||
Default: 1.
|
Default: 1.
|
||||||
|
|
||||||
When opening dir nodes, this setting tells NERDTree to recursively open dirs
|
When opening directory nodes, this setting tells NERDTree to recursively open
|
||||||
that have only one child which is also a dir. NERDTree will stop when it finds
|
directories that have only one child which is also a directory. NERDTree will
|
||||||
a dir that contains anything but another single dir. This setting also causes
|
stop when it finds a directory that contains anything but another single
|
||||||
the |NERDTree-x| mapping to close dirs in the same manner. This setting may be
|
directory. This setting also causes the |NERDTree-x| mapping to close
|
||||||
useful for Java projects. Use one of the following lines for this setting: >
|
directories in the same manner. This setting may be useful for Java projects.
|
||||||
|
Use one of the following lines for this setting: >
|
||||||
let NERDTreeCascadeOpenSingleChildDir=0
|
let NERDTreeCascadeOpenSingleChildDir=0
|
||||||
let NERDTreeCascadeOpenSingleChildDir=1
|
let NERDTreeCascadeOpenSingleChildDir=1
|
||||||
<
|
<
|
||||||
@@ -1362,8 +1369,8 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
|
|||||||
<
|
<
|
||||||
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.
|
||||||
It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of
|
It adds a (redundant) mapping on 'foo' which changes vim's CWD to that of
|
||||||
the current dir node. Note this mapping will only fire when the cursor is
|
the current directory node. Note this mapping will only fire when the
|
||||||
on a directory node.
|
cursor is on a directory node.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.2. Menu API *NERDTreeMenuAPI*
|
4.2. Menu API *NERDTreeMenuAPI*
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ endfunction
|
|||||||
function! s:Bookmark.open(nerdtree, ...)
|
function! s:Bookmark.open(nerdtree, ...)
|
||||||
let opts = a:0 ? a:1 : {}
|
let opts = a:0 ? a:1 : {}
|
||||||
|
|
||||||
if nerdtree#and(g:NERDTreeQuitOnOpen,2)
|
if nerdtree#closeBookmarksOnOpen()
|
||||||
call a:nerdtree.ui.toggleShowBookmarks()
|
call a:nerdtree.ui.toggleShowBookmarks()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function! s:KeyMap.bind()
|
|||||||
else
|
else
|
||||||
let keymapInvokeString = self.key
|
let keymapInvokeString = self.key
|
||||||
endif
|
endif
|
||||||
let keymapInvokeString = escape(keymapInvokeString, '\')
|
let keymapInvokeString = escape(keymapInvokeString, '\"')
|
||||||
|
|
||||||
let premap = self.key ==# '<LeftRelease>' ? ' <LeftRelease>' : ' '
|
let premap = self.key ==# '<LeftRelease>' ? ' <LeftRelease>' : ' '
|
||||||
|
|
||||||
|
|||||||
@@ -65,14 +65,6 @@ function! s:NERDTree.Close()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.CloseIfQuitOnOpen() {{{1
|
|
||||||
"Closes the NERD tree window if the close on open option is set
|
|
||||||
function! s:NERDTree.CloseIfQuitOnOpen()
|
|
||||||
if nerdtree#and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen()
|
|
||||||
call s:NERDTree.Close()
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1
|
"FUNCTION: s:NERDTree.CursorToBookmarkTable(){{{1
|
||||||
"Places the cursor at the top of the bookmarks table
|
"Places the cursor at the top of the bookmarks table
|
||||||
function! s:NERDTree.CursorToBookmarkTable()
|
function! s:NERDTree.CursorToBookmarkTable()
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ function! s:Opener._bufInWindows(bnum)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
||||||
" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
|
" Check the class options to see if the tree should be closed now.
|
||||||
" if the tree should be closed now.
|
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
" a:newtab - boolean. If set, only close the tree now if we are opening the
|
" a:newtab - boolean. If set, only close the tree now if we are opening the
|
||||||
@@ -46,7 +45,7 @@ function! s:Opener._checkToCloseTree(newtab)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if (a:newtab && self._where ==# 't') || !a:newtab
|
if (a:newtab && self._where ==# 't') || !a:newtab
|
||||||
call g:NERDTree.CloseIfQuitOnOpen()
|
call g:NERDTree.Close()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -218,7 +217,7 @@ endfunction
|
|||||||
|
|
||||||
" FUNCTION: Opener._openFile() {{{1
|
" FUNCTION: Opener._openFile() {{{1
|
||||||
function! s:Opener._openFile()
|
function! s:Opener._openFile()
|
||||||
if !self._stay && !nerdtree#and(g:NERDTreeQuitOnOpen,1) && exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
|
if !self._stay && self._keepopen && get(b:, 'NERDTreeZoomed', 0)
|
||||||
call b:NERDTree.ui.toggleZoom()
|
call b:NERDTree.ui.toggleZoom()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ function! s:Path.getSortKey()
|
|||||||
let self._sortKey = [self.getSortOrderIndex()] + metadata
|
let self._sortKey = [self.getSortOrderIndex()] + metadata
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let path = self.getLastPathComponent(1)
|
let path = self.getLastPathComponent(0)
|
||||||
if !g:NERDTreeSortHiddenFirst
|
if !g:NERDTreeSortHiddenFirst
|
||||||
let path = substitute(path, '^[._]', '', '')
|
let path = substitute(path, '^[._]', '', '')
|
||||||
endif
|
endif
|
||||||
@@ -483,7 +483,10 @@ endfunction
|
|||||||
" returns true if this path matches the given ignore pattern
|
" returns true if this path matches the given ignore pattern
|
||||||
function! s:Path._ignorePatternMatches(pattern)
|
function! s:Path._ignorePatternMatches(pattern)
|
||||||
let pat = a:pattern
|
let pat = a:pattern
|
||||||
if strpart(pat,len(pat)-7) ==# '[[dir]]'
|
if strpart(pat,len(pat)-8) ==# '[[path]]'
|
||||||
|
let pat = strpart(pat,0, len(pat)-8)
|
||||||
|
return self.str() =~# pat
|
||||||
|
elseif strpart(pat,len(pat)-7) ==# '[[dir]]'
|
||||||
if !self.isDirectory
|
if !self.isDirectory
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ else
|
|||||||
call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'})
|
call NERDTreeAddMenuItem({'text': '(l)ist the current node', 'shortcut': 'l', 'callback': 'NERDTreeListNodeWin32'})
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists('*system')
|
||||||
|
call NERDTreeAddMenuItem({'text': 'Run (s)ystem command in this directory', 'shortcut':'s', 'callback': 'NERDTreeSystemCommand'})
|
||||||
|
endif
|
||||||
|
|
||||||
"FUNCTION: s:inputPrompt(action){{{1
|
"FUNCTION: s:inputPrompt(action){{{1
|
||||||
"returns the string that should be prompted to the user for the given action
|
"returns the string that should be prompted to the user for the given action
|
||||||
"
|
"
|
||||||
@@ -460,4 +464,21 @@ function! NERDTreeExecuteFileWindows()
|
|||||||
call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
|
call system('cmd.exe /c start "" ' . shellescape(l:node.path.str()))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeSystemCommand() {{{1
|
||||||
|
function! NERDTreeSystemCommand()
|
||||||
|
let l:node = g:NERDTreeFileNode.GetSelected()
|
||||||
|
|
||||||
|
if empty(l:node)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:cwd = getcwd()
|
||||||
|
let l:directory = l:node.path.isDirectory ? l:node.path.str() : l:node.parent.path.str()
|
||||||
|
execute 'cd '.l:directory
|
||||||
|
|
||||||
|
let l:nl = nr2char(10)
|
||||||
|
echo l:nl . system(input(l:directory . (nerdtree#runningWindows() ? '> ' : ' $ ')))
|
||||||
|
execute 'cd '.l:cwd
|
||||||
|
endfunction
|
||||||
|
|
||||||
" vim: set sw=4 sts=4 et fdm=marker:
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
|
|||||||
Reference in New Issue
Block a user