-
Notifications
You must be signed in to change notification settings - Fork 1.4k
F.A.Q.
Press <C-W>w
.
Also you can switch between windows faster by their direction:
"Switch between different windows by their direction`
no <C-j> <C-w>j "switching to below window
no <C-k> <C-w>k "switching to above window
no <C-l> <C-w>l "switching to right window
no <C-h> <C-w>h "switching to left window
Put the above lines in your vimrc, so now you can switch between different windows by their direction easier and faster.
This isn't a NERDTree-specific question, but misunderstanding these Vim "objects" will negatively affect your user experience. Vim is not like other text editors or IDEs, and it shouldn't be made to fit their molds. There is great power in the way Vim handles files (buffers), splits (windows), and layouts (tabs), power that you can't get in other editors. For a better, more in-depth explanation, read the following blog post: http://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs/.
Yes, install nerdtree-git-plugin.
Nope. If this is something you want then chances are you aren't using tabs and buffers as they were intended to be used. Read this http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers. If you are interested in this behaviour then consider vim-nerdtree-tabs
Stick this in your vimrc: autocmd vimenter * NERDTree
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 .
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
or
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | wincmd p | ene | exe 'NERDTree' argv()[0] | endif
The difference between the two is: The first example places the cursor in the empty buffer, while the second example puts it in the NERDTree. 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.
Stick this in your vimrc to open NERDTree with Ctrl+n
(you can set whatever key you want):
map <C-n> :NERDTreeToggle<CR>
Stick this in your vimrc:
autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696 or https://github.com/tiagofumo/vim-nerdtree-syntax-highlight, referenced in the comment.
Use these variables in your vimrc. Note that below are default arrow symbols.
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
Use the t
and T
mappings in the NERDTree window.
You can define a hotkey for it in your .vimrc file. In the example below the d+ key is defined to do so. This hotkey will be valid only until the NERDTree is closed.
autocmd BufEnter NERD_tree_* nmap d<CR> <CR> :NERDTreeToggle <CR>
autocmd BufLeave NERD_tree_* unmap d<CR>