Web Dev Blog

Looking for help with WordPress, Apache, Vim, Web Security and more. Here are a few tips.

Tag: insert

Search for a file name and insert it into a Vi (Vim) file

Something I’ve been trying to do for years and didn’t realize it was so easy. Know when you are editing an html file and want to insert a filename for an image or other asset without leaving Vim? There’s an easy way to do that.

Just use Ctl-X Ctl-f

Completing file names *compl-filename*

*i_CTRL-X_CTRL-F*
CTRL-X CTRL-F Search for the first file name that starts with the
same characters as before the cursor. The matching
file name is inserted in front of the cursor.
Alphabetic characters and characters in 'isfname'
are used to decide which characters are included in
the file name. Note: the 'path' option is not used
here (yet).