Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to force cursor to leave NERDTree window on MacVim startup (mvim .) so I could continue make new split-ups and open certain files in them. But it feels like cursor is stuck in the NERDTree and doesn't listen to me. Here's contents of my .vimrc.local:

function! SplitIt()
  vsplit " this works
  exe "normal \<c-w>\<c-w>" " doesn't. also tried normal ^W^W, bd etc.
  " vsplit Gemfile
  " ...

autocmd VimEnter * call SplitIt()

Tried a whole buncha commands which works well when I type them in NERDTree window, but are useless in this script. Driving me crazy.

Any help will be really appreciated. Thanks!

share|improve this question
up vote 0 down vote accepted

I use NERDTree and this works. It switches from NERDTree window to the file I want to edit, and splits (or whatever you want to do):

function! SplitIt()
    exe "normal \<c-w>\<c-w>"

autocmd VimEnter * call SplitIt()

Other possibility is beginning with it disabled and enable it with F2 or any other key:

Comment the line that enables it at the beginning:

""" autocmd VimEnter * NERDTree

And add a map to enable it easily:

map <F2> :NERDTreeToggle<CR>
share|improve this answer
I've updated Janus to January 2012 release and put the script into ~/.vimrc.after now this works. Thanks for help. – jibiel Jan 17 '12 at 8:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .