Tab to complete interferes with snippet expansion.
jordwalke opened this issue · comments
In the following document (JavaScript syntax):
iftest
if<cursor>
If the completion window is open, iftest
is the first selected item. Hitting tab completes when the user likely wishes to expand the if() snippet. People who use snippets usually use <CR>
to select a completion because it interferes with the snippet expansion (<tab>
).
I see two simple options:
- Allow for the disabling of tab to select a completion - possibly by default.
- (More difficult) - give priority to snippet expansion on tab. (Maybe customize the priority?)
I think (using the modulate-demodulate
branch) you can just do ((ViMap completionMap) unmap:"<tab>")
and simply disable tab as a completion selector.
Priority to snippet expansion should also be doable by mapping <tab>
in the completion map to some function that invokes accept_completion_or_complete_partially:
on the text view conditionally based on whether a snippet corresponds or not.
The most intrusive approach would move that logic into accept_completion_or_complete_partially:
, and decide based on whether this is an autocomplete popup and whether there's an available snippet to do the right thing. I'm a little more hesitant to hardcode that if there are user-scriptable solutions, however. That brings up the question of what the default should be (tab selecting a completion vs not), and that's something we can discuss on Discourse.