Vim Tips Wiki
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

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!
* Cool! How would I do this using the new compsys (compdef?) instead of the old compctl?
+
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>
<nowiki> </nowiki> reply=(${=$(cat ./tags | grep "^${cur}" | cut -f1)})
+
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>
<nowiki>#</nowiki>end vim tag
+
#end vim tag
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)