mirror of
https://github.com/amix/vimrc
synced 2025-06-17 19:35:00 +08:00
Updated plugins
This commit is contained in:
@ -148,12 +148,16 @@ autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in
|
||||
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
|
||||
```
|
||||
|
||||
### How can I close Vim automatically when NERDTree is the last window?
|
||||
### How can I close Vim or a tab automatically when NERDTree is the last window?
|
||||
|
||||
```vim
|
||||
" Exit Vim if NERDTree is the only window left.
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
|
||||
\ quit | endif
|
||||
" Exit Vim if NERDTree is the only window remaining in the only tab.
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
|
||||
```
|
||||
---
|
||||
```vim
|
||||
" Close the tab if NERDTree is the only window remaining in it.
|
||||
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
|
||||
```
|
||||
|
||||
### How can I prevent other buffers replacing NERDTree in its window?
|
||||
@ -168,7 +172,7 @@ autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_
|
||||
|
||||
```vim
|
||||
" Open the existing NERDTree on each new tab.
|
||||
autocmd BufWinEnter * silent NERDTreeMirror
|
||||
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
|
||||
```
|
||||
or change your NERDTree-launching shortcut key like so:
|
||||
```vim
|
||||
|
Reference in New Issue
Block a user