gpanda
gpanda

Reputation: 3530

How to let Vim show a list of alternative file paths of the same basic name when use gf?

I know, in Vim, gf leads me to the file (actually the first one) whose name is under or after the cursor, n gf leads to the n th file with the same basic name.

I wonder how I can let Vim show a list of all alternatives(if there are), just like g<C-]> to give a list of those for a symbol under the cursor, so I can select the one I'm interested in.

Generally speaking, I need this feature to jump to a c header file that I care.

e.g.

/usr/include/x86_64-linux-gnu/bits/string.h
/usr/include/string.h       -- I care this
/usr/include/linux/string.h

Upvotes: 3

Views: 95

Answers (1)

Jim K
Jim K

Reputation: 13790

How about Smartgf? From the page:

It's better than default gf because:

  • It doesn't use ctags. So you don't need to run anything after changes.
  • It shows you all available matches.

...

Use 1-9 keys as quick shortcuts to select search result or use j,k to change cursor position in the dialog and o,Enter to choose selected item.

Upvotes: 1

Related Questions