File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -100,16 +100,15 @@ Stick this in your vimrc:
100
100
101
101
Note: Now start vim with plain ` vim ` , not ` vim . `
102
102
103
+
103
104
---
104
- > How can I open NERDTree on startup, and have my cursor start in the other window ?
105
+ > How can I open NERDTree as a window automatically when vim starts up on opening a directory ?
105
106
106
- Stick this in your vimrc:
107
+ autocmd StdinReadPre * let s:std_in=1
108
+ autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
107
109
108
- autocmd vimenter * NERDTree
109
- autocmd vimenter * wincmd p
110
+ This trick also prevents NERDTree from hiding when first select a file.
110
111
111
- * via [ stackoverflow/Yohann] ( http://stackoverflow.com/questions/4277808/nerdtree-auto-focus-to-file-when-opened-in-new-tab/19330023#19330023 ) *
112
-
113
112
---
114
113
> How can I map a specific key or shortcut to open NERDTree?
115
114
You can’t perform that action at this time.
0 commit comments