Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

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>"
    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>
share|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 '12 at 8:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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