How do you do it?
相关问题
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- Insert text into current buffer from function
- Hot reload on save
- Substituting zero-width match in vim script
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- How can I use gcc's -I command to add recursiv
- Vim: overloaded mapping for multiple modes
- How to use relative line numbering universally in
- How to copy the value of a vim option to a registe
- E185: Cannot find color scheme*
- How do I fix vim to properly indent folds containi
The answers here have a minor problem.
If you call
vim --noplugin
or use a script that uses--noplugin
mode such as vimpager, it will cause this error:To avoid this, put the command in
~/.vim/after/plugin/NERD_tree.vim
instead:And it might also be a good idea to test that
NERDtree
is available as well, i.e.:Are you on a Windows or unix-y system?
If you're on a unix-y system you put plugins in
~/.vim/plugin
. Here's what my plugin directory looks like:After that it starts working right away. Try running vim like this:
It should open the current directory in the NERD tree view.
If you're on Windows you put plugins here:
C:\Program Files\Vim\vim70\plugin
To get NERDTree to load automatically when you start up vim, run it like this from the command line:
You can set an alias for this in your
.bashrc
:Now whenever you run
vimt
(instead ofvim
) you'll also open up NERDTree on the left side of the window.You could also add a shortcut key to start NERDTree in your
.vimrc
this way:Now when you hit
Esc
thent
it will pop open NERDTree.I like to see NERDTree only when I start vim without file arguments, so I added this to my .vimrc:
As per the instructions on https://github.com/scrooloose/nerdtree, you can just use pathogen.vim (https://github.com/tpope/vim-pathogen). Install pathogen with:
Add this to your vimrc:
then install NERDTree:
And if you want to open a NERDTree automatically when vim starts up, add the following to your vimrc:
Okay, the previous version was a bit terse, but the answer you're looking for is to add the line below into your
~/.vimrc
file. It tells vim that you want to setup a command to run when vim starts, but since it depends on various plugins to be loaded, you don't want to run it until all initialization is finished. The line below does this.If, however, you're annoyed by the fact that the cursor always starts in the NERDTree window, you can add a second autocommand that will move the cursor into the main window, like so: