我在 Windows 中使用 gvim。默认情况下,nerdtree 加载 C:\ 驱动器作为默认值。我喜欢将其更改为 E:\ 驱动器。如何实现这一点?
每当我尝试使用 :NERDTree 命令启动 NERDTree 时,都会收到此错误E492: Not an editor command: NERDTree
我的vimrc
文件中有以下代码
cd ~/documents
map <F2> :NERDTreeToggle<CR>
" open Nerd Tree in folder of file in active buffer
map <Leader>nt :NERDTree %:p:h<CR>
该cd
命令不是 NerdTree 特定的。它只是在 Vim 启动时更改工作目录,这对我来说是明智的。
从 NERDTree 帮助文件:
: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)
在我的vimrc
文件中,我使用了这个。应该设置你的默认驱动器,但是,它只是 NERDTree 的工作目录autocmd vimenter * NERDTree G:\
。G:\
添加cd G:\
更改 vim 开始工作目录。就像 Jeromy Anglim 说的那样。