我正在编写一个小python脚本来学习VIM基础知识(我是VIM的初学者)。 我已经将VIM配置为与omnicompletion一起工作,它确实做到了。 例如,如果我写str,然后按ctr+x,ctr+o它会提示我所有的字符串方法。 但是在我的代码中我有这样的内容:
for line in inFile.readlines():
something = line.rpartition(" ")[0]
我希望VIM在键入后自动完成rppartition方法名行.rpart. 我不希望它知道行对象类型,但我希望VIM根据python库的了解提出一个上下文无关的完成列表。 例如,如果使用eclipse我试图完成
^{pr2}$它向我建议了一个分区方法,即使它与一个对象无关!在
有没有可能让它和维姆一起工作?
谢谢。在
我的.vimrc文件:
set showcmd
set textwidth=80
set expandtab
set smarttab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set number
set autoindent
filetype indent on
filetype plugin on
autocmd BufRead,BufNewFile *.py syntax on
autocmd BufRead,BufNewFile *.py set ai
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,with,try,except,finally,def,class
set modeline
syntax on
" Closes the Omni-Completion tip window when a selection is
" made
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
您肯定应该看看PySmell,它可以很容易地为Vim安装。它根据给定项目的静态分析生成完成菜单。它还可以根据为外部库(如Python标准库或Django库)生成的标记生成完成建议。在
我对Vims Python omnicimpletion很满意,但自从我改用pysnous之后,我就再也没有回头看了。在
说真的,用Jedi!在
它真的比周围所有的自动完成都要好得多。在
愿原力与你同在!在
相关问题 更多 >
编程相关推荐