I have the following line in my .vimrc to open NERDTree on startup:NERDTreeToggleNow, if I start vim, I have NERDTree on the left and the file I opened on the right.The left window is focused on startup. How can I put the focus on the right window on startup?
Define active window for startup in .vimrc
vimrc;vim windows
You can do this with a simple autocommand:au VimEnter * wincmd lThis tells vim anytime you open a new vim window (VimEnter) on any file type * to run the ex command :wincmd l. wincmd l is effectively the same thing as pressing <C-w>l in normal mode, which moves you one split to the right. From :h ctrl_w-lCTRL-W CTRL-L                   *CTRL-W_CTRL-L* *CTRL-W_l*CTRL-W l    Move cursor to Nth window right of current one.  Uses the        cursor position to select between alternatives.