Question

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 /Users/me.

Any ideas?

Was it helpful?

Solution

I did this

(all changes in .vimrc)

  1. Enabled NERDTree as default.

    autocmd VimEnter * NERDTree
    
  2. Put this script I got from github in .vimrc. This will make vim AND NERDTree buffer quit with :q

  3. 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.

OTHER TIPS

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

This problem (if it is the one I think it is) was fixed in Snapshot 55, so a simple update should fix it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top