omni-completion usability

Issue #72 wontfix
created an issue

It seems like the auto-completion functionality in vimclojure already does the hard part in implementing completion (finding the right vars in the current ns, etc.), but the interaction makes it a bit awkward to use. With a bit of enhancement this could be a really, great feature though. I think this emacs completion video shows what the ideal behavior would be:

For starters I thought I'd try to highlight some of the issues, and then I'll checkout the source to see if I can help work on this.

1) show doc string in adjacent popup, rather than in a new buffer - currently a new doc buffer pops up above the current buffer, which shifts text on screen and makes it hard to keep track of where you are. This hurts the flow of editing and makes it jarring to use completion. Having a doc string popup next to the function list would be ideal, and it would limit the amount of motion on screen. (This is also what people are used to from other IDEs and emacs.)

2) tab or type to complete word - currently the whole term is completed immediately after pressing <c-x><c-o>. This means you can't just read the list and keep typing the name you want, but instead you are forced to go to the arrow keys. Ideally the list would continue to filter as you type more characters, and then pressing tab would complete with the currently selected completion. (It would be cool if <c-j> and <c-k> could be used to scroll up and down the completion list also, to make it easy to stay on the home row.)

3) More generally, it would be great if the building block functions for this feature are documented and accessible so people could easily assign keys to things and help experiment with usability.

This is really the defining feature of modern IDEs, and I think it is the major missing piece from typical VimClojure powered editing. With the functionality so close to being equivalent to an IDE, I think it's worth going the last few steps. Thanks for all your hard work.

Cheers, Jeff

Comments (3)

  1. Meikel Brandmeyer repo owner

    These questions are not trivial. They touch what is technically possible as well as what is in the scope of VimClojure itself.

    1. Not possible. You cannot open pop-ups via Vim's own means. The window popping open is the so-called preview window – Vim's answer to this question. The only way to do a popup is ballooneval which works only for the GUI version of Vim and then not on Mac for example. I don't think that much is possible here. A workaround might be keep the preview window open to avoid the windows „jumping.“
    2. This is not in the scope of VimClojure. Omni completion works as it does. VimClojure just provides Clojure support for that. If you don't like the way it is, you'll have to investigate scripts like supertab. (This also applies to a certain degree to the previous point.)
    3. Yes, this is a rather sad point. The code documentation sucks and has to be improved. I hope to replace the clojure side with a backend which is commonly shared with other IDEs (which then is better documented hopefully). The Vim side is similarly bad documented but more regular. Clearly to be improved.

    All your points are valid concerns, but the limit here is clearly Vim. Improving omni completion has to be done in Vim itself. VimClojure will benefit from it as well as all the other plugins.

  2. Meikel Brandmeyer repo owner

    The Vim completion does at least a little bit of what you want. Check out :help 'cot'. In particular the preview and longest parts. It allows even typing more characters and narrowing down the possibilities.

  3. rosejn reporter

    Ok, thanks for responding. It's too bad that the popup functionality added in vim7 wasn't made usable as a general feature. I'll work on configuring supertab to see what I can do to improve it.

  4. Log in to comment