In VIM you can use the command
J to join to lines:
hello -> J -> hello goodday goodday
Where the cursor is positioned somewhere on the ‘hello’ line.
But I often find myself wanting to use the opposite, I want ‘hello’ to be put after ‘goodday’. The cursor is now positioned on the ‘goodday’ line.
hello goodday -> K -> goodday hello
The following mapping does that:
map K kddpkJ
- Go up 1 line:
- Delete the entire line:
- Paste line below the current one:
- Go up again:
- Perform the join:
In less words: switch the lines and then do a join.