René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Registers in VIM

A register can be cleared with qxq (x being the name of the register). Technically, it starts recording a macro (q) into register x (x) and immediatly stop recording this macro (q).

Assigning values to registers in a script

In order to assign a value to a register in a script, the @x syntax can be used. x is the name of the register. So, the following line assigns foo bar to the register named a:
let @a = 'foo  bar'

Special registers

  • ":
    The unnamed register. In a script, use @ (let @@='bla'). This register is filled with d, c, s, x and y commands.
  • 1 through 9:
    the numbered registers. These are filled from yank and delete commands.
  • -:
    the small delete register. Filled with commands that delete less than a line. Not used if the command is explicetely used together with another register.
  • a through z and A through Z:
    The named registers.
  • :, ., % and #:
    the read only registers. The colon (:) contains the most recently executed command line. The dot (.) contains the last insertet text. The percent sign (%) contains the name of the file. And the hash sign containts the name of the alternate file.
  • =:
    the expression register. It is a read only register as well.
  • *, + and ~:
    the selection and drop registers. Selects text into the clip board (Windows).
  • _:
    the black hole register. Used to, for example, delete text in no other register.
  • /:
    the last search pattern register. Used in conjunction with highlighing