Sometimes I want to autocomplete a tag name containing a colon, for example g:netrw_gx
.
I've added to the 'tags'
option the location of the tags
file of the main documentation (which on my machine seems to be /usr/share/vim/vim74/doc/tags
):
set tags+=$VIMRUNTIME/doc/tags
The default mapping to autocomplete a tag name is <C-x><C-]>
.
The problem is if I type g:net
and then hit <C-x><C-]>
, Vim decides that the tag name begins after the colon, so the candidates which are suggested in the pop-up menu all begin with net
, while I want candidates beginning with g:net
.
I think the reason for this is given in an excerpt from :h ctrl-x_ctrl-]
:
Alphabetic characters and characters in 'iskeyword' are used
to decide which characters are included in the tag
name (same as for a keyword).
When looking for the tag name to complete, Vim takes probably all the characters from the cursor position back to the first character which is not in the 'iskeyword'
option.
And a colon is not in 'isk'
, as the output of :echo &isk
is @,48-57,_,192-255,#
which doesn't contain :
or 58
(ascii code of :
).
I don't want to change the value of 'isk'
as I suspect it would break many things (text-objects, plugins).
How can I autocomplete tag names containing a colon?