From b78fa833730de846c132a7318a00d8fb4fe29581 Mon Sep 17 00:00:00 2001 From: Ggicci Date: Sun, 9 Oct 2016 20:28:33 +0800 Subject: [PATCH] Fix opening current directory in NERDTree tab. --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index a72894a..34b9ef1 100644 --- a/README.markdown +++ b/README.markdown @@ -102,10 +102,10 @@ Note: Now start vim with plain `vim`, not `vim .` --- -> How can I open NERDTree as a tab window automatically when vim opens a directory? +> How can I open NERDTree as a tab window 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") | NERDTree | wincmd p | ene | endif + autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif This trick also prevents NERDTree from hiding when first select a file.