vim - insert current filename

When writing comments in source code or for some other reason than I can think of right now, I like to include the current filename into current vim session.

How?
  • Enter insert mode
  • use following key sequence: ctrl-r %
POOF! You have the filename (it does include the path).

In vim % is the current filename. It is very useful when writing mappings or running commands from the : prompt.

Comments

Post a Comment

Popular posts from this blog

Changing Dancer::Plugin::Ajax's content type

BootstrapX clickover

2 ways to get SQLite to put dates into columns