created May 5, 2004 · complexity basic · author Florentin Ionescu · version 5.7
Ctags allows you to search for a tag associated with an identifier.
This script allows to search for an identifier in the current open file without using an identifier, that is displays the "tags" file for current opened file.
cat /usr/local/bin/vimlocal.sh echo | /usr/bin/ctags --extra=+fq --if0=yes --file-scope=yes --fields=+afmikKlnsz --c-types=+cdefgmnpstuvx --c++-types=+cdefgmnpstuvx -x -n --filter "$@" | tr -s '[ \t]' '@' |sed -e "s,^\([_-~:A-Za-z]\+\)@\([_-~:A-Za-z]\+\)@\([0-9]\+\).*, \3 \1," | sed -e "s,[_-~A-Za-z]\+::,,"|sort -k1 -n |uniq
map <M-l> <Esc>:!/usr/local/bin/vimlocals.sh % <CR>:
1. ctags options probably don't have to be so many.
2. There are more complex alternatives like excellent taglist.vim which will open and IDE type environment but I prefer simple solutions based on unix command-lines.
Huh? To search in this file for an identifer in this file, why not just hit * while the cursor is on the identifier?
I haven't tried the tip, but I'm assuming it's so you can jump to the function declaration, rather than match for every occurrence of the keyword.
"F4" (see help) and/or search helps for identifier under cursors. This is not a substitute for "tags" file, it just helps to look for indentifier (function or variable ) which is not under the cursor and jump between them which is helpfull when you work with large files.