You are viewing a read-only archive of the Blogs.Harvard network. Learn more.
Skip to content

Insert the current filename into current edited file in vim

I had a need for inserting the name of the current file into a bunch of files I was editing. I was pretty sure there was a function to do this in vim and after some searching I was right.

To insert the current filename. In Insert Mode, type CTRL-r % and it will insert the current filename.

Thanks to blog post for the tip!

Be Sociable, Share!