Closed otonvm closed 11 years ago
What does :echo has('python')
say?
Edit:
Sorry, this makes no sense. You don't have to do that. You have Python... Otherwise NameError
wouldn't occur.
Can you post your vimrc?
Here you go:
" Setup pathogen to dir 'bundles'
runtime bundles/pathogen/autoload/pathogen.vim
call pathogen#infect('bundles')
" Make Vim more useful
set nocompatible
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
" change movement to the new line
set whichwrap+=<,>,h,l
" Optimize for fast terminal connections
set ttyfast
" Add the g flag to search/replace by default
set gdefault
" For regular expressions turn magic on
set magic
" disable spelling
set nospell
" remap <leade>
let mapleader=","
" Centralize backups, swapfiles and undo history
" backups:
set backup
set backupdir=~/.vim/tmp
" swaps:
set directory=~/.vim/tmp
set writebackup
" undo:
set undofile
set undodir=~/.vim/tmp
set undolevels=1000
set undoreload=10000
" auto cleanup on startup:
silent execute '!rm ~/.vim/tmp/*'
" automatically change directory
set autochdir
" Enable line numbers
set number
" Add a bit extra margin to the left
set foldcolumn=1
" Highlight current line
set cursorline
" Make tabs 4 spaces wide
set softtabstop=4
set shiftwidth=4
set expandtab
set smarttab
" Show “invisible” characters
set list "display spaces
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_ "everything else
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases if the search contains upper case
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Always show the status line
set laststatus=2
" Format the status line
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
" Enable mouse in all modes
set mouse=a
" Don't redraw while executing macros (good performance config)
set lazyredraw
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Don’t reset cursor to start of line when moving around.
set nostartofline
" Show the cursor position
set ruler
" Don’t show the intro message when starting Vim
set shortmess=atI
" Show the current mode
set showmode
" Show the filename in the window titlebar
set title
" Show the (partial) command as it’s being typed
set showcmd
" Start scrolling three lines before the horizontal window border
set scrolloff=3
" Save a file as root (,W)
noremap <leader>W :w !sudo tee % > /dev/null<CR>
" Enable filetype plugins
filetype plugin on
filetype indent on
" Set to auto read when a file is changed from the outside
set autoread
" Fast saving
nmap <leader>w :w!<cr>
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32")
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
else
set wildignore+=.git\*,.hg\*,.svn\*
endif
" Height of the command bar
set cmdheight=2
" Treat .json files as .js
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
" Solarized color scheme:
syntax on
let g:solarized_menu=0
set background=dark
colorscheme solarized
" Font
set anti gfn=Source_Code_Pro:h11,Monaco:h11
" Use UTF-8 without BOM
set encoding=utf-8 nobomb
" Better line-height
set linespace=2
" cursor-blinking off
set guicursor=a:blinkon0
" favorite fileformats
set fileformats=unix,dos,mac
" set default-encoding to utf-8
set encoding=utf-8
" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc,.pdf,.exe
" controls the default paper size and the printing of syntax highlighting (:n -> none)
set printoptions=paper:a4,syntax:y
" edit/reload .vimrc-Configuration
command! ConfigEdit :tabe $MYVIMRC
command! ConfigReload :source $MYVIMRC|echo "Configuration reloaded"
"enable omni-complete
set omnifunc=syntaxcomplete#Complete
" Move a line of text using ALT+[jk] or Comamnd+[jk] on mac
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
if has("mac") || has("macunix")
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif
"SuperTab options
let g:SuperTabCompletionContexts = ['s:ContextText', 's:ContextDiscover']
let g:SuperTabContextTextOmniPrecedence = ['&omnifunc', '&completefunc']
let g:SuperTabContextDiscoverDiscovery = ["&completefunc:<c-x><c-u>", "&omnifunc:<c-x><c-o>"]
Also creating a new file or opening a file results in this error:
line 198:
Traceback (most recent call last):
File "<string>", line 6, in <module>
ImportError: No module named os
I removed everything except pathogen and solarized. Then I added
autocmd FileType python set omnifunc=pythoncomplete#Complete
to .vimrc. Now in a python file :set ofu
shows omnifunc=pythoncomplete#Complete
.
Now if I write impC-x C-o
(as if I wanted to complete 'import') I get this error:
Error detected while processing function pythoncomplete#Complete:
line 35:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function pythoncomplete#Complete:
line 35:
File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function pythoncomplete#Complete:
line 35:
NameError: name 'vimcomplete' is not defined
Press ENTER or type command to continue
Error detected while processing function pythoncomplete#Complete:
line 36:
E121: Undefined variable: g:pythoncomplete_completions
Press ENTER or type command to continue
I guess I have some other problems here... I'm on Mac OS X 10.6.8, I installed Python 2.7.3 and MacVim through homebrew.
Hmm.. I have absolutely no idea. Except the usual stuff...
Have tried re-installing the whole thing (including vim)? And have you tried enabling just the bare minimum of the vimrc? Just the pythoncomplete command?
Can you post the <file>
contents of vim --startuptime <file> some_python_file.py
?
Well never mind, I rebuilt python 2 and macvim, cleaned all python packages and now everything works as expected.
Thanks anyway for your help and keep up the good work!
Just had this issue as well after re-installing jedi-vim.
Turns out I forgot to cd into the jedi-vim submodule and run git submodule update --init
in order to get the jedi code.
Thanks for the report! It may help to solve it for others.
Solved it for me--thanks!
i also use mac os x,when i use:git clone --recursive http://github.com/davidhalter/jedi-vim the problem is solved.
i also use mac os x,when i use:git clone --recursive http://github.com/davidhalter/jedi-vim the problem is solved.
i also use mac os x,when i use:git clone --recursive http://github.com/davidhalter/jedi-vim the problem is solved.
sorry for posted so much,cause github say there's something wrong.
@banxi1988 No problem, I know what you're talking about.
I had the same problem however running git submodule upgrade fixed it. However could someone explain why this would fix the problem because i have no clue what I did haha
when you git clone something, it does not clone all it's submodules as well. you need to run submodule update in order to do this. if you don't do this, the submodule folders will simply be empty and therefore important files to run jedi vim will be missing. On 2 Jul 2013 05:35, "nielsdebruin" notifications@github.com wrote:
I had the same problem however running git submodule upgrade fixed it. However could someone explain why this would fix the problem because i have no clue what I did haha
— Reply to this email directly or view it on GitHubhttps://github.com/davidhalter/jedi-vim/issues/53#issuecomment-20312192 .
Thanks for quick response, I get it now. Btw I really enjoyed your talk on vim! Keep up the good work.
2013/7/2 Martin Brochhaus notifications@github.com
when you git clone something, it does not clone all it's submodules as well. you need to run submodule update in order to do this. if you don't do this, the submodule folders will simply be empty and therefore important files to run jedi vim will be missing. On 2 Jul 2013 05:35, "nielsdebruin" notifications@github.com wrote:
I had the same problem however running git submodule upgrade fixed it. However could someone explain why this would fix the problem because i have no clue what I did haha
— Reply to this email directly or view it on GitHub< https://github.com/davidhalter/jedi-vim/issues/53#issuecomment-20312192> .
— Reply to this email directly or view it on GitHubhttps://github.com/davidhalter/jedi-vim/issues/53#issuecomment-20326053 .
I encounter the same Error.
At first,
error: required vim compiled with +python
Then rebuild vim7.4 with --enable-pythoninterp and --with-features=huge
Now,
Error detected while processing function jedi#show_func_def:
line 1:
.....
Ubuntu 12.04 python 2.7
I need help
hmm, :ver
?
@davidhalter Thank you, I have solved it. this plugin is very useful.
@walkingnine How? What was the problem?
hi @davidhalter ,
The Error message is:
Error detected while processing function jedi#show_func_def:
line 1:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function jedi#show_func_def:
line 1:
File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function jedi#show_func_def:
line 1:
NameError: name 'jedi_vim' is not defined
Then I use pip to install jedi, now It works very well.
But the autocompletion is inaccurate sometimes, by the way, I don't set the plugin and just use the default configurations.
for example, when I type
pygame.font.
the autocompletion should be
Font
get_init
FontType
init
SysFont
match_font
get_default_font
quit
get_fonts
_PYGAME_C_API
__name__
__PYGAMEinit__
__new__
__class__
__package__
__delattr__
__reduce__
__dict__
__reduce_ex__
__doc__
__repr__
__file__
__setattr__
__format__
__sizeof__
__getattribute__
__str__
__hash__
__subclasshook__
__init__
Actually, the autocompletion is:
info
mro
name
reason
urgent
warn
_NOT_IMPLEMENTED
__class__
__deltattr__
__format__
__getattr__
__getattribute__
__hash__
__init__
__new__
__nonzero__
__reduce__
__reduce_ex__
__repr__
__setattr__
__sizeof__
__str__
__subclasshook__
Yes. It's not always perfect. In some cases, people use setattr
or modifications of globals()
... Jedi currently just ignores those commands.
hi @davidhalter , Thank you. I also often use ipython for off-the-cuff programming, using these two tools to help me tip what I forgot. you are good stuff, thank you again for your contributions!
psst... autocompletion works also in IPython: https://github.com/davidhalter/jedi/pull/280#issuecomment-23046996
Documentation for that: http://jedi.jedidjah.ch/en/dev/docs/repl.html
I'm sorry I thought Jedi was nothing but only served for the vim-plugin jedi-vim, so I didn't notice Jedi before you said. Now, It's so amazing and powerful that I settle on it as my preferred tool.
banxi1988's comment solved my problem. Thank you! Just remove jedi-vim under bundle and run git clone --recursive http://github.com/davidhalter/jedi-vim
It's probably my error somewhere but I cannot install jedi-vim probably because a module is not found; I get this error while doing anything on a .py file:
First I followed this guide: http://redkrieg.com/2012/12/11/writing-python-like-a-jedi/ then I tried installing the jedi module in python directly and importing jedi in python (which worked) but no difference.
I have no other settings about python in vimrc or any other modules.
Any ideas?