Home > gotofile

gotofile

Gotofile is a project mainly written in Vim Script, it's free.

gf replacement by using the tags file

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1812

This script defines a new command 'GotoFile', which resembles the normal 'gf' function, but uses a standard tags file generated by ctags for looking up the file name under the cursor.

You need to generate a standard tags file (with ctags) for this script to work. Add the following ctags option for generating filename tags: --extra=+f

For example: ctags -R --extra=+f

Add the following mapping to your .vimrc (or _vimrc) to replace the normal 'gf' behavior by the GotoFile command:

nmap gf :GotoFile

I wrote this script mainly for having an alternative for setting the path and using 'gf'. While using completion all header files within the path are also searched, which causes a major performance hit for large projects (at least for me). So this script allows using the 'gf' feature without setting the path. Other suggestions are welcome!