Create a command shortcut for NERDTree in Vim editor

Viewed 34659

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?

5 Answers

add to your rc file (.bashrc / .zshrc) this shortcut

alias nerd="nvim -c \"NERDTree\""

then, reload your bash width

source ~/.zshrc # or ~/.bashrc according your case

and run

nerd

the -c flag allows you to execute a command when starting the terminal

nvim -c "command"
Related