Skip to content

Commit

Permalink
Fix opening current directory in NERDTree tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggicci committed Oct 9, 2016
1 parent 1c0d9ef commit b78fa83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.markdown
Expand Up @@ -102,10 +102,10 @@ Note: Now start vim with plain `vim`, not `vim .`


---
> How can I open NERDTree as a tab window automatically when vim opens a directory?
> How can I open NERDTree as a tab window automatically when vim starts up on opening a directory?
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | NERDTree | wincmd p | ene | endif
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif

This trick also prevents NERDTree from hiding when first select a file.

Expand Down

0 comments on commit b78fa83

Please sign in to comment.