I was wondering why “visual block mode” wasn’t working for me. The key is to yank (or delete) in visual mode.
I find myself needing to copy some stuff from excel columns having variable lengths. Here’s how I do it:
Names
Donald Knuth
Sebastian Thrun
Peter Norvig
Satoshi Nakamoto
Age
100
50
60
45
Let’s say you want to put the second column after the first.
- Yank it in visual mode:
- Move cursor to the beginning of
Age - Press
Ctrl + vto enter visual mode - Move cursor to
5in45 - Press
yto yank (ordto delete)
- Move cursor to the beginning of
You have now yanked in visual mode.
-
Paste (in normal mode)
-
Move to the end of the first line and add more spaces because it’s shorter than the second line for example. If you paste a “block” without adding extra spaces, it will overwrite the “run” in Sebastian Thrun.
-
Now you’re on the first line, insert a few spaces after the last character. Make sure you’re not in insert mode and hit
pto paste the block. (If you want to paste in insert mode, usectrl+r ")
-
