Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer-local SuperTabContextDefaultCompletionType #153

Closed
powerman opened this issue Jul 9, 2015 · 1 comment
Closed

buffer-local SuperTabContextDefaultCompletionType #153

powerman opened this issue Jul 9, 2015 · 1 comment

Comments

@powerman
Copy link

powerman commented Jul 9, 2015

Can you please add support for b:SuperTabContextDefaultCompletionType or ability to set buffer-local version of that var using call SuperTabContextDefaultCompletionType()?

Here is use-case for this feature. I'm use very comprehensive omni completion for Go (http://github.com/fatih/vim-go). It detect things like variable's scope, so it's really better than simple keyword completion. Because of this I'd like to use omni-completion not only for method names, but also for usual variable/function names. But I also need fallback to keyword completion in case omni completion fail (for example, this helps a lot when writing comments/doc and wanna complete words already used in comments or names of variables which isn't in current scope, or complete language keywords like "func", "switch" which isn't supported by omni, etc.). And, of course, I don't like to lose ability to use "context" as default completion type (both because I like filename completion and because there is no sense in fallback to keyword completion when I complete method name).

Right now I see only way to implement this:

let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabContextDefaultCompletionType = "<c-x><c-u>"
autocmd FileType *
    \ if &omnifunc != '' |
    \   call SuperTabChain(&omnifunc, "<c-p>") |
    \ endif

But this result in completion failure in buffers which doesn't provide &omnifunc. So, I need something like this instead:

let g:SuperTabDefaultCompletionType = "context"
autocmd FileType *
    \ if &omnifunc != '' |
    \   call SuperTabChain(&omnifunc, "<c-p>") |
    \   let b:SuperTabContextDefaultCompletionType = "<c-x><c-u>"
    \ endif
@powerman
Copy link
Author

powerman commented Jul 9, 2015

Another idea was to provide &omnifunc in buffers which doesn't have it. I've tried to implement one as no-op, but it doesn't work as expected, not sure why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant