NERDTree does not open in the directory from which macvim was opened
I upgraded my macvim to 7.3 recently and I can no longer open nerdtree or netw in the directory in which macvim was opened, it always opens in my home directory.
For example,
If I open macvim in /users/me/test/project dir, I want the NERDTree root to be /Users/me/test/project and not /Use开发者_开发知识库rs/me.
Any ideas?
You could map the key you use to open NERDTree like this(in .vimrc):
map <silent> <F1> :NERDTreeToggle %:p:h<CR>
This maps my F1 key to toggle(open/close) NERDTree using the path of the currently active buffer. If no buffer is open, it opens in the currently launched Macvim directory.
I had this problem after upgrading janus. simply adding this to my .gvimrc fixed it:
set autochdir
This will set the working directory to the current file.
More info here: http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file
I did this
(all changes in .vimrc)
Enabled NERDTree as default.
autocmd VimEnter * NERDTree
Put this script I got from github in .vimrc. This will make vim AND NERDTree buffer quit with
:q
Say, your project folder is /home/user/my-project, then do this:
mvim /home/user/my-project/README
You wil get the parent folder in the NERDTree with the files in it.
This problem (if it is the one I think it is) was fixed in Snapshot 55, so a simple update should fix it.
精彩评论