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
  " ...
endfunction

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!

link|improve this question
feedback

1 Answer

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>"
    vsplit
endfunction

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>
link|improve this answer
I've updated Janus to January 2012 release and put the script into ~/.vimrc.after now this works. github.com/carlhuda/janus/wiki/Customization Thanks for help. – jibiel Jan 17 at 8:38
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.