-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnerdtree.config.vim
More file actions
21 lines (15 loc) · 971 Bytes
/
nerdtree.config.vim
File metadata and controls
21 lines (15 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
" https://github.com/scrooloose/nerdtree
" How can I open a NERDTree automatically when vim starts up?
autocmd vimenter * NERDTree
" How can I open a NERDTree automatically when vim starts up if no files were specified?
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" 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 | exe 'cd '.argv()[0] | endif
" How can I map a specific key or shortcut to open NERDTree?
map <C-n> :NERDTreeToggle<CR>
" How can I close vim if the only window left open is a NERDTree?
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Hot can I jump to the tree and focus current source file?
map <Leader>j :NERDTreeFind<Enter>