Edit Page
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 51: | Line 51: | ||
==Comments== |
==Comments== |
||
+ | * Cool! |
||
− | + | How would I do this using the new compsys (compdef?) instead of the old compctl? |
|
− | |||
* It didn't work for me. The problem was that "$cur" was being populated with "vim -t", which most likely would not match anything in the tags file. I used the following, |
* It didn't work for me. The problem was that "$cur" was being populated with "vim -t", which most likely would not match anything in the tags file. I used the following, |
||
− | #vim tags |
+ | #vim tags<br> |
− | function _get_tags { |
+ | function _get_tags {<br> |
− | [ -f ./tags ] || return |
+ | [ -f ./tags ] || return<br> |
− | local cur |
+ | local cur<br> |
− | read -l cur |
+ | read -l cur<br> |
− | cur=`echo $cur | grep -o -- "-t<nowiki>[[:space:]]\+[[:alnum:]]</nowiki>\+" | cut -d' ' -f2` |
+ | cur=`echo $cur | grep -o -- "-t<nowiki>[[:space:]]\+[[:alnum:]]</nowiki>\+" | cut -d' ' -f2`<br> |
− | + | reply=(${=$(cat ./tags | grep "^${cur}" | cut -f1)})<br> |
|
− | } |
+ | }<br> |
− | compctl -x 'C[-1,-t]' -K _get_tags -- vim |
+ | compctl -x 'C[-1,-t]' -K _get_tags -- vim<br> |
− | + | #end vim tag |