Python 自动补全 大全(IPython,readline,vim)

如果想使用交互式命令行自动补全,建议使用Ipython。

IPython 比使用
import readline, rlcompleter; readline.parse_and_bind(“tab: complete”)
启动的自动补全更好些。例如import 时也可以自动补全模板名。

想为vim启动自动补全需要下载插件。

http://vim.sourceforge.net/scripts/script.php?script_id=850

下载后将 pydiction 文件解压到 ~/.vim/tools 目录下。
然后对.vimc 增加以下内容

” python auto-complete code
” Typing the following (in insert mode):
” os.lis
” will expand to:
” os.listdir(
” Python 自动补全功能,只需要反覆按 Ctrl-N 就行了
if has(“autocmd”)
autocmd FileType python set complete+=k~/.vim/tools/pydiction
endif

现在使用Ctr+N 就可以自动补全了。

 

相关日志

2 Responses so far »

  1. 1

    dreamer said,

    四月 18, 2009 @ 8:33 上午

    我还是不大喜欢用Vim,Emacs之类的编辑器
    用着图形界面化的总感觉要方便的多

    估计我就是太懒

  2. 2

    gamexg said,

    六月 30, 2009 @ 9:32 上午

    @dreamer
    其实设置好的话,vim更方便。

Comment RSS · TrackBack URI

Say your words