How can I emulate key presses on Vim startup?

Solution 1:

There are a couple of ways to give Vim keypresses in a command. The general way is to use the :normal command, which in this case would be

:execute "normal \<C-W>\<C-W>"

where the :execute command is needed to expand the control characters. For normal commands that begin with Ctrl-W, however, the :wincmd command can be simpler to use, e.g.,

:wincmd w

where in this case I've taken advantage of the fact that Ctrl-W Ctrl-W and Ctrl-W w do the same thing. Your autocommand would then be

autocmd VimEnter * wincmd w

See

:help :normal
:help :wincmd
:help CTRL-W_w