changing root in NERDTree

与世无争的帅哥 提交于 2019-11-29 02:59:58

You could try something like:

nnoremap <leader>n :NERDTree /path/to/folder<CR>

I have this in my .vimrc:

set autochdir
let NERDTreeChDirMode=2
nnoremap <leader>n :NERDTree .<CR>

so that NERDTree always opens in the current folder.

With the 1st line, the working directory is always the one where the active buffer is located.

With the 2nd line, I make sure the working directory is set correctly.

With the 3rd line, I hit <leader>n to open NERDTree.

As i don't want vim to change directories automatically, i just use:

com! -nargs=1 -complete=dir Ncd NERDTree | cd <args> |NERDTreeCWD

so you can just do a ":Ncd path/you/like/" with path completion.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!