mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 03:43:50 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1fa4a33bf | ||
|
|
3a9d533f3d | ||
|
|
d3f9fc44ca | ||
|
|
1d46d6df3e |
@@ -5,6 +5,8 @@
|
|||||||
- **.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.10
|
||||||
|
- **.7**: Fix mouse-clicking a file to open it. (PhilRunninger) [#1225](https://github.com/preservim/nerdtree/pull/1225)
|
||||||
|
- **.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)
|
- **.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)
|
- **.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)
|
- **.3**: Add new FAQ and answer: How to prevent buffers replacing NERDTree. (PhilRunninger) [#1215](https://github.com/preservim/nerdtree/pull/1215)
|
||||||
|
|||||||
@@ -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).
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTr
|
|||||||
### How can I prevent other buffers replacing NERDTree in its window?
|
### How can I prevent other buffers replacing NERDTree in its window?
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" If another buffer tries to replace NERDTree, put in the other window, and bring back NERDTree.
|
" 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 |
|
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
|
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
|
||||||
```
|
```
|
||||||
@@ -183,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,12 +30,12 @@ endfunction
|
|||||||
" SECTION: General Functions {{{1
|
" SECTION: General Functions {{{1
|
||||||
"============================================================
|
"============================================================
|
||||||
|
|
||||||
" FUNCTION: nerdtree#closeTreeOnOpen()
|
" FUNCTION: nerdtree#closeTreeOnOpen() {{{2
|
||||||
function! nerdtree#closeTreeOnOpen() abort
|
function! nerdtree#closeTreeOnOpen() abort
|
||||||
return g:NERDTreeQuitOnOpen == 1 || g:NERDTreeQuitOnOpen == 3
|
return g:NERDTreeQuitOnOpen == 1 || g:NERDTreeQuitOnOpen == 3
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: nerdtree#closeBookmarksOnOpen()
|
" FUNCTION: nerdtree#closeBookmarksOnOpen() {{{2
|
||||||
function! nerdtree#closeBookmarksOnOpen() abort
|
function! nerdtree#closeBookmarksOnOpen() abort
|
||||||
return g:NERDTreeQuitOnOpen == 2 || g:NERDTreeQuitOnOpen == 3
|
return g:NERDTreeQuitOnOpen == 2 || g:NERDTreeQuitOnOpen == 3
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -397,7 +373,7 @@ function! s:handleLeftClick() abort
|
|||||||
if currentNode.path.isDirectory
|
if currentNode.path.isDirectory
|
||||||
call currentNode.activate()
|
call currentNode.activate()
|
||||||
else
|
else
|
||||||
call currentNode.activate({'reuse': 'all', 'where': 'p'})
|
call currentNode.activate({'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()})
|
||||||
endif
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user