I installed jedi-vim
with pathogen, and it now works.
EDIT: to reply to the comments below: I get jedi-vim to work by reinstalling it using pathogen instead of installing it from source. This fixed my issue, so I considered it to be an answer.
문제
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?
해결책 5
I installed jedi-vim
with pathogen, and it now works.
EDIT: to reply to the comments below: I get jedi-vim to work by reinstalling it using pathogen instead of installing it from source. This fixed my issue, so I considered it to be an answer.
다른 팁
This is the basic installation of Jedi with Pathogen.
Install Pathogen
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
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
Install Jedi.
cd ~/.vim/bundle/ && git clone --recursive https://github.com/davidhalter/jedi-vim.git
If you have
set paste
in your .vimrc file, jedi will fail to run.
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
I think the problem is your vim version is too low,I suggest you update to vim 7.4 and make sure it has open the python function,If you want autocomplete function, I suggest you can try You complete Me,It is more powerful,it need Vim 7.3.584+,now the vim 7.4 is come out,it is easy to install, you can install in this ways,
#!/bin/bash
MyInstallDir="/root/MyVim74Install/"
cd ~
mkdir MyVim74Install
if [ -d $MyInstallDir ]; then
echo "create MyInstallDir success"
else
echo "create MyInstallDir Error"
fi
cd $MyInstallDir
pwd
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
tar -zxvf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure
make
make install
make clean
cd ~
cd $MyInstallDir
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
tar xzvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
./bootstrap
make
make install
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -jxvf vim-7.4.tar.bz2
cd vim74 ./configure --enable-gui=gtk2 --enable-cscope --enable-multibyte --enable-xim --enable-fontset \
--with-features=huge --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config
make
make install
make clean
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
apt-get install gcc
apt-get install g++
wget http://prdownloads.sourceforge.net/ctags/ctags-5.6.tar.gz
tar -zxvf ctags-5.6.tar.gz
cd ctags-5.6
./configure &&make &&make install
ctags -R