iezo3g
Last Updated: February 25, 2016
·
705
· design48

vim search for function or word in file

was looking how to jump to function definition and file and came across this handy shortcut. It's not like ctags but jump to every listing of the word in the current file, pretty handy.

Type g* (or just * - see below) to search for the word under the cursor (in this case, the function name). Then press n to go to the next (or Shift-n for previous) occurance.

It doesn't jump directly to the definition, given that this command just searches for the word under the cursor

(a) * will jump to the next occurrence of the word under the cursor. (No need to type the g, the 'goto' command in vi).

(b) # goes to the previous occurrence, in similar fashion.