Comments (8)
Unfortunately, there is no current way in vim to detect when no completion results are found, so to automatically switch to an alternate completion method isn't currently possible.
What I do in the case you've described is to use a separate mapping, <c-space>
in my case, to force keyword completion. Supertab includes a function that can be mapped to which handles cancelling the current completion mode and starting the specified one. Here is my mapping which I use to force the <c-p>
keyword completion mode:
imap =SuperTabAlternateCompletion("c-p>")
Note: in my console, urxvt, I actually have to map to <nul>
to get <c-space>
imap =SuperTabAlternateCompletion("c-p>")
from supertab.
Could you explain why the format of g:SuperTabContextDiscoverDiscovery
is the way it is? It seems to me that you're just stripping out the from that anyways.
from supertab.
The idea with the format is that it allows you to define simple expressions to determine whether to turn a particular completion type on or not. The example in the docs uses the completefunc
and omifunc
options to basically say, if this option is set, enable this completion type, if not, go to the next one. However, instead of using those vim options you could use some other variable or even define a function to decide if a completion type should be chosen or not:
["MyFunc():<c-x><c-u>", ...]
So the goal is to provide the flexibility to hopefully do things I haven't thought of.
from supertab.
couldn't one write a completion function that calls multiple functions? I see that getting a completion is a two step process, determining where the completion starts and then returning a list of completions, but it should be somewhat easy to wrap them. I'll work on a function for this maybe it won't be so hard. I'll keep you informed.
from supertab.
The problem is that aside from user and omni completion, there is no function to call to get completion results. Maybe a custom function could call one of those and if no results are found then attempt to use feedkeys to fallback to something else. I'm not sure how vim will react to a feedkeys call at that point, and there are probably some subtle edge cases, but it may work.
Let me know how it goes.
from supertab.
I have also wanted to fall back to Keyword completion if no completions are found using omnicomplete.
Would it be possible to detect if no completion results are found using pumvisible()?
Thanks
from supertab.
As far as supertab is concerned, not really. All supertab does is intelligently decide which keys need to be sent to vim and then sends them. Supertab has no idea what the result of sending those keys was, nor does it have any hook into knowing when those keys have been fully processed to examine the result. I suppose supertab could tack on an additional <c-r>=
expression to what is sent to vim to maybe get such a hook in place. Whether or not that would work, I'm not sure, but I'd try the wrapped ominfunc approach I described in my previous comment first.
When I get enough free time I'll see if I can put something together.
from supertab.
Latest couple[1] of commits[2] provide a new experimental way to
chain together one of omni/user completion with a fall back to any
other vim supplied completion key binding.
from supertab.
Related Issues (20)
- Supertab doesn't work in command-line window HOT 4
- Mirror-like auto-completion pop-up when there is no space above the cursor!
- vim writes 4 spaces instead of a tab when supertab is installed HOT 4
- Tab inserts the highlighted word
- Inconsistency with inserting highlighted word HOT 1
- Remap tab when no completion is active HOT 2
- Toggle supertab plugin HOT 1
- Completion seems to offer key word in preference to omni completion HOT 1
- E432: Tags file not sorted: tags HOT 1
- Make tab cycle through completions
- Using mac os native command+tab to swap between elements enters in fast loop
- Supertab don't complete local path HOT 1
- Disable for a filetype HOT 3
- How to complete function name without '(' char? HOT 1
- On-the-fly completion HOT 1
- Supertab shows other suggestions as OmniComplete HOT 1
- Missing highlight update in popup completion menu HOT 4
- Select the last item when pressing Tab HOT 2
- [feature request] - incremental/partial completion instead of longest/complete match HOT 1
- Suptertab chaining is not working with neovim LSP HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supertab.