Auto-open NERDTree in “EVERY” tab

后端 未结 7 2370
说谎
说谎 2020-11-30 22:10

Is it possible to open NERDTree in every tab with pressing t or T in NERDTree, if yes, How?

7条回答
  •  我在风中等你
    2020-11-30 22:30

    This problem was actually mentioned in the official Repository's Readme file including three situations related to opening NERDTree automatically:


    How can I open a NERDTree automatically when vim starts up?

    Stick this in your vimrc: autocmd vimenter * NERDTree


    How can I open a NERDTree automatically when vim starts up if no files were specified?

    Stick this in your vimrc:

    autocmd StdinReadPre * let s:std_in=1
    autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
    

    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
    

    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.

提交回复
热议问题