Page History

Vim

Mark George edited this page on 31 Oct

Clone this wiki locally

Reuse last selection

gv

Jump to last edit

There are a few ways to do this (and I can never remember a single freaking one of them). The best option is to use the changes history:

View the change history:

:changes

The current position is the history is marked by a >

Jump back in the history:

g;

Jump forward:

g,

Multi-select cut/paste

This appends the copied selection into a register, so first clear the register using qaq (for the a register - use qbq for b, etc). This records an empty macro into the register, so you will see messages relating to macros in the status line.

Multi-select yank using :g/<search term>/y A

Multi-select delete using :g/<search term>/d A

A is the a register, but the uppercase variant causes the command to append to the register. If you didn't append then you will only end up with the last selection in the register.

Paste using "ap where a is the register.

You can view the currently used registers with :registers (shorthand :reg)

Clearing registers

The registers can fill up with crap over time if you have persistence turned on. You can clear out all the registers using the following command:

let regs=split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-"', '\zs') | for r in regs |  call setreg(r, []) |  endfor | unlet regs