Vim Register Use in Ex Mode

Posted by Peck on Stack Overflow See other posts from Stack Overflow or by Peck
Published on 2010-03-09T00:57:45Z Indexed on 2010/03/09 1:06 UTC
Read the original article Hit count: 509

Filed under:
|
|

Potentially 2 questions in one. I would like to know how to reference a register in Ex mode.

For instance, I'm editing a file and I want to save the file with a timestamp (or just datestamp really) appended to it.

I know I can set register to the value of a shell commands output using:

:let @a = system("date +\"%Y-%m-%d\"")

Is there any to dereference this register and insert its value into an Ex command? Something like:

:w testfile.<value of "a register>

Copying to the system clipboard and pasting would be nice, but doing it in a more generic/programitic way for building on other commands in the future would be nice.

© Stack Overflow or respective owner

Related posts about vim

Related posts about registers