Let's say I want to jump to a particular position in a file in an existing Vim server:

This command jumps to the correct line, but not the correct column, leaving the cursor at the start of the line:

gvim.exe --servername VimServer --remote-silent +"normal! 5G5|"

If I add in an :execute, however, the command works as desired:

gvim.exe --servername VimServer --remote-silent +"execute 'normal! 5G5|'"

Note that removing the 5G line movement does not affect the issue. normal! 5| jumps to the start of the current line. execute 'normal! 5|' jumps to the fifth column.

I also tried a few other motions. These will all leave the cursor at the start of the (correct) line unless run with :execute:

normal! w
normal! l
normal! j
normal! )
normal! %

What's going on?

1 Answer 1


I haven't looked deeply into it, but reading :help --remote, it mentions this about +{cmd}:

This must be an Ex command that can be followed by "|".

Your :normal interprets the remainder as normal mode commands; you'd need a :{cmd} to execute {cmd} as an Ex command. By wrapping this in :execute, only the quoted string is executed, and the normal mode initiated by :normal ends after that, and additional Ex commands can follow after a |, as requested.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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