diff --git a/README.markdown b/README.markdown index 6efeb0b..75b311a 100644 --- a/README.markdown +++ b/README.markdown @@ -64,10 +64,12 @@ Note: Now start vim with plain `vim`, not `vim .` > How can I open NERDTree 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") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif + autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif This window is tab-specific, meaning it's used by all windows in the tab. This trick also prevents NERDTree from hiding when first selecting a file. +Note: Executing `vim ~/some-directory` will open NERDTree and a new edit window. `exe 'cd '.argv()[0]` sets the `pwd` of the new edit window to `~/some-directory` + --- > How can I map a specific key or shortcut to open NERDTree?