commit e1916d6fe71f5ff84b74dbca881a598fcda877c4 parent 84737f2ebe533ffac9ebc21da8d1f57216962641 Author: Spencer <spencerdcarlson@gmail.com> Date: Tue, 5 Mar 2019 09:25:49 -0700 Update directory .vimdc readme example (#961) * set pwd for new window * adding 'cd '.argv()[0] explination * spacing * exe * [0] Diffstat:
| M | README.markdown | | | 4 | +++- |
1 file changed, 3 insertions(+), 1 deletion(-) diff --git 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?
