mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-22 10:06:16 +08:00
Update directory .vimdc readme example (#961)
* set pwd for new window * adding 'cd '.argv()[0] explination * spacing * exe * [0]
This commit is contained in:
parent
84737f2ebe
commit
e1916d6fe7
|
@ -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?
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user