I'm currently programming in Tcl/Tk. I have some widgets called .entry,stdin and .entry,stdout and I'm using supertab for autocompletion. The comma is there because I'm using a package called gridplus and that's how I can access the standard Tk widget functionality.

The idea of using auto-completion is that when I type .entry, and press the tab key it will show ONLY stdin and stdout as possible answers. However when I do that it shows all the possible words in the file instead of just stdin and stdout. And when tried autocomplpop and neocomplcache it doesn't even pop the menu after .entry,

I guess vim is interpreting the , as a word separator even though there is no space. When I tried swapping , for _ it works because I think vim is interpreting it as one word. So I guess is more to do with vim interpretation of what a word is, rather than a plugin matter. However, I'm wondering if it is possible to change this behavior?


Change the 'iskeyword' option to control how vim decide what a word is. In your case you can add a comma to it to tell vim that your words consists of commas too:

:set iskeyword+=,

It's not perfect for your need but I think it's better that the default.

Check out :help iskeyword while you're at it.

| improve this answer | |
  • Just tried this and repeated my experiment adding this,what to the dictionary and guess what? It works. +1 – goldilocks Aug 31 '13 at 14:45

I guess is more to do with vim interpretation of what a word is, rather than a plugin matter.

Not really, since the people who write the plugins presumably know what they are doing, and this behavior is on purpose and not by accident. Unfortunately, it isn't what's good for you in this case.

The built-in completion (see :help E535 and omnicompletion in the wiki), won't be any better either -- I notice it actually uses a comma as a separator for things in a dictionary, so if you add "this,what" it will include completion for "this" and "what" but not "this,what". [However, see holygeek's answer for the solution].

What you want is not impossible -- the omnicppcomplete plugin will do completion for C++ on '.', '->', and '::', so why not one which does it for ','? The problem is most likely no one has written anything alone those lines...

| improve this answer | |
  • @milarepa : Don't bother, it's C++ specific, I was just using that as an illustration of what can be done. holygeek's suggestion looks much more promising (guess I might be wrong about the significance of "what vim thinks a word is"). – goldilocks Aug 31 '13 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.