4

I installed both plugins using Pathogen, but they don't work together as it should be. That is, if I use TAB, I get SuperTab's completion (autocomplete what I have previously written) whereas if I use CTRL + SPACE I get Jedi's completion (everything from libs: classes, modules, etc).

In theory, if both plugins are installed SuperTab should handle Jedi seamlessly, but that's not my case. I found this report of some people experiencing the same behavior, while others saying it works for them. There is no solution provided though.

The plugins I'm using don't override each other:

ls ~/.vim/bundle/
auto-pairs  nerdtree  syntastic    vim-trailing-whitespace
jedi-vim    supertab  vim-airline

So what else may be causing this behavior?

vimrc:

set nu
set ts=4
set sw=4
set mouse=a
set showmatch
set expandtab
set background=dark
syntax on
filetype plugin indent on

execute pathogen#infect()

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
1

As a simple solution, try adding this line to your vimrc:

let g:SuperTabDefaultCompletionType = "context"

This will result in the following behavior, which should be what you need in most cases:

/usr/l<tab>  # will use filename completion
myvar.t<tab> # will use user completion if completefunc set, or
             # omni completion if omnifunc set.
myvar-><tab> # same as above

You can always check :help supertab-completioncontexts if you need a more personalized behavior.

What jedi-vim does is set omnifunc option to use the function it provides. This means that jedi-vim is only used when performing omni-completion. If you want to force SuperTab to always use omni-completion then you can also use the following option instead of the above one:

let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"
1
  • let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"this did the trick! – user5235 Nov 11 '15 at 16:55
0

The default for SuperTab is to use <C-p> completion, vim-jedi, however, starts with <C-Space>. You need to tell SuperTab that you want to use that ;-)

You can configure this with:

let g:SuperTabDefaultCompletionType = '<C-@>'

The @ refers to the space. You may also want to set:

let g:SuperTabMappingForward = '<C-@>'
let g:SuperTabMappingBackward = '<S-C-@>'

This is documented in :help g:SuperTabDefaultCompletionType, :help g:SuperTabMappingForward.

1
  • just added those lines and the result is that for autocompletion I need to use CTRL+Space (Jedi), and if I use TAB it adds a TAB (well, 4 whitespaces). I'm excepting to use TAB and get the same output I get using CTRL+Space (i.e. Jedi's output) – user5235 Nov 9 '15 at 11:49

Your Answer

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