显示目录 (The NERD Tree)

2016-01-28


项目主页:https://github.com/scrooloose/nerdtree

配置

  • 当没有指定文件打开时,自动打开 NERDTree

    autocmd StdinReadPre * let s:std_in=1
    autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
    
  • 关闭 vim 的时候如果只剩下 NERDTree, 那么自动关闭 NERDTree

    autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
    

快捷键

" 打开/关闭 NERDTree
map <C-n> :NERDTreeToggle<CR>