我正在编写一个小 Python 脚本来学习 VIM 基础知识(我是 VIM 的初学者)。我已经将 VIM 配置为使用omnicompletion,并且确实如此。例如,如果我写 str. 然后按 ctr+x,ctr+o 它建议我所有的字符串方法。但是在我的代码中,我有这样的东西:
for line in inFile.readlines():
something = line.rpartition(" ")[0]
我希望 VIM 在输入 line.rpart 后自动完成 rpartition 方法名称。我不希望它知道线对象类型,但我希望 VIM 提出一个基于 python 库熟人的上下文不感知完成列表。例如,如果使用 eclipse 我尝试完成
anObject.rpart
它建议我使用 rpartition 方法,即使它与 anObject 无关!
是否有可能让它与 VIM 一起使用?
谢谢。
我的 .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