开发者

Making NERDTree work 'as expected'

I want to be able to o or double click on a file in NERDTree, and have it open in a split to the right, and have NERDTree stay open. I haven't found the magic dus开发者_JAVA技巧t to sprinkle on my .vimrc to make this happen yet, can anyone help?

I'd want to to behave like any GUI text editor, where the explorer persists and the files open and close in the 'main pane'.

Thanks for any insight!


Try this in your .vimrc:

:let NERDTreeQuitOnOpen = 0

I find the following mappings useful:

nnoremap <Leader>d :let NERDTreeQuitOnOpen = 1<bar>NERDTreeToggle<CR>
nnoremap <Leader>D :let NERDTreeQuitOnOpen = 0<bar>NERDTreeToggle<CR>

So \d opens a NERDTree that closes on file selection, while \D opens a persistent/pinned NERDTree.


By putting the following lines in your .vimrc config will open NERDTree automatically when vim starts up on opening a directory vim ReactProjectFolder and prevent NERDTree from hiding when first selecting a file

autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | wincmd p | ene | exe 'NERDTree' argv()[0] | endif

Taken from the nerdtree f.a.q

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜