nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 148e8570df11ca300f4bebc10d3d3c72357e6f52
parent f26eaf83551631e683e339f00e2c97bd6e8356d7
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date:   Mon, 10 Oct 2016 15:06:53 -0400

Merge pull request #628 from ggicci/master

Add note in README: trick to open NERDTree as a window on startup.
Diffstat:
MREADME.markdown | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/README.markdown b/README.markdown
@@ -100,16 +100,15 @@ Stick this in your vimrc:
 
 Note: Now start vim with plain `vim`, not `vim .`
 
+
 ---
-> How can I open NERDTree on startup, and have my cursor start in the other window?
+> How can I open NERDTree as a window automatically when vim starts up on opening a directory?
 
-Stick this in your vimrc:
+    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 * NERDTree
-    autocmd vimenter * wincmd p
+This trick also prevents NERDTree from hiding when first select a file.
 
- *via [stackoverflow/Yohann](http://stackoverflow.com/questions/4277808/nerdtree-auto-focus-to-file-when-opened-in-new-tab/19330023#19330023)*
- 
 ---
 > How can I map a specific key or shortcut to open NERDTree?