Vim command - ex mode - is there any way to move the cursor position?

In one line, the Vim ex command:

I try to execute a command, and then move to another place and execute the same command.

Is there any way to move the cursor position (need both left / right and up / down)?

+7
scripting vim
source share
2 answers

"|" is a command separator in Vim scripts.

:command the_first | second command 

performs two commands.

There is also a normal command that allows you to execute normal mode commands, such as motion commands, from the Ex command line. So maybe you can do something like

 :/pat.*$/d | exec "normal 32G5w" | /pat.*$/d 

There is probably an easier way to do what you are trying to do, if you can be more specific.

+8
source share

Your question is not entirely clear, but I think you want to use a post. I hope you know the movement commands h, j, k, l. Try the following:

  <goto command mode> qa i dddd <esc> j q @a 

qa is a command to start writing to buffer a . q used to stop recording. Buffer a can be used with @a . Also try 10@a to perform the operation 10 times.

+2
source share

All Articles