I'd like to create an abbreviation for NERDTree on the command-line. I find it annoying have to write :NERDTree
every time I want to enable it. So I'd like to type :nr
or something like that. Is that possible?
I normally switch screen in vim using ctrl+h or ctrl+l to switch between NerdTree and vim main window. Vim8 got :term command to bring up terminal which is great!
First, bring up NERDTree and navigate to the directory where you want to create the new file. Press m to bring up the NERDTree Filesystem Menu. This menu allows you to create, rename, and delete files and directories. Type a to add a child node and then simply enter the filename.
In my .vimrc
I have:
let mapleader = "," nmap <leader>ne :NERDTree<cr>
So when I need NERDTree I just write ,ne
in normal mode.
I find this works very nicely, better than any other suggestions I've tried:
map <silent> <C-n> :NERDTreeFocus<CR>
You just hit control-n to go back to the hierarchy. Selecting a file name in the hierarchy will switch you, of course, to that file.
:NERDTree
command starts you from scratch, closing the hierarchy, while using :NERDTreeFocus
simply moves the focus, which I think is what you want)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With