Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get the jedi-vim plugin to work

I'm trying to use the jedi-vim plugin for Python autocompletion but I can't get it to work.

I have Vim 7.3, and here's what I did:

1- clone the code from

git clone http://github.com/davidhalter/jedi-vim path/to/bundles/jedi-vim

2- copy jedi-vim/plugin/jedi.vim to ~/.vim/plugin/

3- copy jedi-vim/doc/jedi-vim.txt to ~/.vim/doc/

Now when I open vim, enter the insert mode and type

import wave
wave.

nothing happens, though the doc specify Autocompletion is also triggered by typing a period in insert mode, and if I try <Ctrl-Space> I get the following error

E29: No inserted text yet
Press ENTER or type command to continue

I checked :map and it seems that <Ctrl-Space> is not used:

n  [m          *@:call <SNR>21_Python_jump('?^\s*\(class\|def\)')<CR>
n  [[          *@:call <SNR>21_Python_jump('?^\(class\|def\)')<CR>
n  ]m          *@:call <SNR>21_Python_jump('/^\s*\(class\|def\)')<CR>
n  ]]          *@:call <SNR>21_Python_jump('/^\(class\|def\)')<CR>
n  gx            <Plug>NetrwBrowseX
n  <Plug>NetrwBrowseX * :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<CR>

Since I got an error using <Ctrl-Space>, I guess it must do something, right? Why can't I see it with :map?

What am I missing?

edit

:scriptnames

  1: /usr/share/vim/vimrc
  2: /usr/share/vim/vim73/debian.vim
  3: /usr/share/vim/vim73/syntax/syntax.vim
  4: /usr/share/vim/vim73/syntax/synload.vim
  5: /usr/share/vim/vim73/syntax/syncolor.vim
  6: /usr/share/vim/vim73/filetype.vim
  7: ~/.vimrc
  8: ~/.vim/plugin/jedi.vim
  9: /usr/share/vim/vim73/ftplugin.vim
 10: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
 11: /usr/share/vim/vim73/plugin/gzip.vim
 12: /usr/share/vim/vim73/plugin/matchparen.vim
 13: /usr/share/vim/vim73/plugin/netrwPlugin.vim
 14: /usr/share/vim/vim73/plugin/rrhelper.vim
 15: /usr/share/vim/vim73/plugin/spellfile.vim
 16: /usr/share/vim/vim73/plugin/tarPlugin.vim
 17: /usr/share/vim/vim73/plugin/tohtml.vim
 18: /usr/share/vim/vim73/plugin/vimballPlugin.vim
 19: /usr/share/vim/vim73/plugin/zipPlugin.vim
 20: /usr/share/vim/vim73/syntax/vim.vim
 21: /usr/share/vim/vim73/syntax/python.vim
 22: /usr/share/vim/vim73/ftplugin/vim.vim

edit 2

I updated Vim to 7.4 and installed vim-jedi using pathogen as described in the doc:

1- install jedi 2- install pathogen 3- add execute pathogen#infect() in my ~/.vimrc 4- clone git repository in ~/.vim/bundle/

I create a new file, and I still have no autocompletion. Eg:

import numpy as np
np.

and control+space in insert mode returns:

-- Omni completion (^O^N^P) Pattern not found

Is there any omni completion plugin conflicting? I haven't installed such plugin...

Should I had anything else to my ~/.vimrc file?

like image 302
jul Avatar asked Feb 07 '14 13:02

jul


2 Answers

This is the basic installation of Jedi with Pathogen.

  1. Install Pathogen

    mkdir -p ~/.vim/autoload ~/.vim/bundle && \
    curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
    
  2. Configure.vimrc
    if you have a ~/.vimrc file: add the following line to it

    execute pathogen#infect()
    

    else: create a blank file named .vimrc at your home folder and add the following lines to it.

    execute pathogen#infect()
    syntax on
    filetype plugin indent on
    
  3. Install Jedi.

    cd ~/.vim/bundle/ && git clone --recursive https://github.com/davidhalter/jedi-vim.git
    
  4. enjoy!

    enter image description here

like image 127
All Іѕ Vаиітy Avatar answered Oct 09 '22 17:10

All Іѕ Vаиітy


I had a similar error because of a mismatch between the python version I intended to use and the one that was called.

Make sure jedi is using the intended version of python. E.g. add let g:jedi#force_py_version = 3 to your .vimrc

like image 27
0-_-0 Avatar answered Oct 09 '22 17:10

0-_-0