NERDTree Load Particular Directory Automatically

2019-04-06 17:34发布

I'm using gvim in windows.By default nerdtree loads C:\ drive as default.I like to change it to E:\ drive.How to achieve this?

Whenever I try to start NERDTree using :NERDTree command, I get this error E492: Not an editor command: NERDTree

标签: vim nerdtree
2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-04-06 18:26

From the NERDTree help-file: :NERDTree [<start-directory> | <bookmark>] *:NERDTree* Opens a fresh NERD tree. The root of the tree depends on the argument given. There are 3 cases: If no argument is given, the current directory will be used. If a directory is given, that will be used. If a bookmark name is given, the corresponding directory will be used. For example: > :NERDTree /home/marty/vim7/src :NERDTree foo (foo is the name of a bookmark)

查看更多
看我几分像从前
3楼-- · 2019-04-06 18:28

I have the following code in my vimrc file

cd ~/documents
map <F2> :NERDTreeToggle<CR>
" open Nerd Tree in folder of file in active buffer
map <Leader>nt :NERDTree %:p:h<CR>

The cd command is not NerdTree specific. It just changes the working directory when Vim starts to something which for me is sensible.

查看更多
登录 后发表回答