How can I use something like this?
:g/^$/kJ
Here kJ are two commands, instead of just one (like 'd')
My concrete example: I have multiple lines looking like this
queryBuilder
.append("xyz");
and I want to make them look like this:
queryBuilder.append("xyz");
So what I want to do for each line is
:g/^[\t]*\..*$/kJx
which matches the correct pattern but seems to execute only k.
Are other vim commands suitable here? How would you perform this task?
You can execute more than one command by placing a | between two commands. This example substitutes for htm, then moves on to JPEG, then GIF. The second command (and subsequent commands) are only executed if the prior command succeeds.
gg will move you to the first line in the file, and G will move you to the last line in the file. Alternatively, if you type nG where n is a number, you'll jump to that to that line.
You will see list of commands that matches characters in front of the cursor by pressing CTRL-D in the command mode. For example, if you pressed :se in normal mode, then pressed CTRL-D , you will see list of commands that start with se .
The Ex mode is similar to the command line mode as it also allows you to enter Ex commands. Unlike the command-line mode you won't return to normal mode automatically. You can enter an Ex command by typing a Q in normal mode and leave it again with the :visual command.
Add the normal
instruction to execute all of them, like:
:g/^[\t]*\..*$/normal kJx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With