If things look a little dusty around here, it's because I'm away on a mission for two years. I'll be back in August 2012, but in the mean time feel free to fork my projects on github.
Vim tip of the day: copy current file name
Apr 17, 2010
by Jared

If you want to copy/paste the current filename, the magic register "%" is just what you need.

It's as simple as "%p (which means p[aste] from the register %)

"%p

Or if you're in insert mode, <C-r>% will do the same.

Note: this will always be the filename of the current window/buffer. To save this in a regular register (for later use), try:

O<C-r>%<Esc>"fdd

that transfers it to the f register.

roughly translated:

O      on a new line (go into insert mode)
<C-r>% paste the contents of %
<Esc>  exit insert mode
"fdd   then delete that line and put it into f
blog comments powered by Disqus