Yank with a motion, trimming the ends of block rows
zy
Example
Normal 0 / 4Visual block 1 / 4Visual block 2 / 4Visual block 3 / 4Normal 4 / 4 ab
cd Cursor on line 1, column 1 ab
cd Cursor on line 1, column 1 · Block selection ab
cd Cursor on line 1, column 5 · Block selection ab
cd Cursor on line 2, column 5 · Block selection ab
cd Cursor on line 1, column 1Yank with a motion, trimming the ends of block rows.
Vim registers
"Unnamed register- Characterwise · Uses Yank register 0
saved 0Yank register 0- Characterwise
saved
Selection active · ready to adjust or apply
Vim registers
"Unnamed register- Characterwise · Uses Yank register 0
saved 0Yank register 0- Characterwise
saved
Selection active · ready to adjust or apply
Vim registers
"Unnamed register- Characterwise · Uses Yank register 0
saved 0Yank register 0- Characterwise
saved
Selection active · ready to adjust or apply
Vim registers
"Unnamed register- Characterwise · Uses Yank register 0
saved 0Yank register 0- Characterwise
saved
Yanked the selected block with trailing spaces trimmed from each row.
Vim registers
"Unnamed register Changed- Blockwise · 5 · Uses Yank register 0
··ab↵ ··cd 0Yank register 0 Changed- Blockwise · 5
··ab↵ ··cd
Before & after
ab
cd Cursor on line 1, column 1Vim registers
"Unnamed register- Characterwise · Uses Yank register 0
saved 0Yank register 0- Characterwise
saved
ab
cd Cursor on line 1, column 1Vim registers
"Unnamed register Changed- Blockwise · 5 · Uses Yank register 0
··ab↵ ··cd 0Yank register 0 Changed- Blockwise · 5
··ab↵ ··cd
Start in Normal mode. Select a literal block, then yank it without trailing spaces. The exact block register is read from this Vim build.
Details & Vim help
Example replayed in Vim
In Normal mode, follow zy with a motion. In Visual mode, use it on the selection. For blockwise text, zy trims trailing spaces on each yanked row.