mNo edit summary |
|||
Line 7: | Line 7: | ||
<pre> |
<pre> |
||
#vim tags |
#vim tags |
||
− | function |
+ | function _get_tags { |
[ -f ./tags ] || return |
[ -f ./tags ] || return |
||
local cur |
local cur |
||
Line 13: | Line 13: | ||
echo $(echo $(awk -v ORS=" " "/^${cur}/ { print \$1 }" tags)) |
echo $(echo $(awk -v ORS=" " "/^${cur}/ { print \$1 }" tags)) |
||
} |
} |
||
− | compctl -x ' |
+ | compctl -x 'C[-1,-t]' -K _get_tags -- vim |
#end vim tags |
#end vim tags |
||
</pre> |
</pre> |
Revision as of 21:00, 16 August 2010
This tip was inspired by a tip on using bash completion with ctags.
This implementation is significantly simpler but gets the basic job done.
Completing ctags with ZSH
Add the following to your ~/.zshrc file:
#vim tags function _get_tags { [ -f ./tags ] || return local cur read -l cur echo $(echo $(awk -v ORS=" " "/^${cur}/ { print \$1 }" tags)) } compctl -x 'C[-1,-t]' -K _get_tags -- vim #end vim tags
Then start a new shell or source your rc file:
source ~/.zshrc
References
Using_bash_completion_with_ctags_and_Vim