Ubuntu 下 vim 搭建python 环境 配置

yipeiwu_com6年前Python基础

1. 安装完整的vim

# apt-get install vim-gnome

2. 安装ctags,ctags用于支持taglist,必需!

# apt-get install ctags

3. 安装taglist

#apt-get install vim-scripts
#apt-get install vim-addon-manager
# vim-addons install taglist

4. 安装pydiction(实现代码补全)

#wget http://www.pythonclub.org/_media/Python-basic/pydiction-1.2.zip
#unzip pydiction-1.2.zip
// ~/.vim/after/ftplugin和~/.vim/tools/pydiction/目录默认不存在,需要自行创建
#cp pydiction-1.2/python_pydiction.vim ~/.vim/after/ftplugin
#cp pydiction-1.2/complete-dict ~/.vim/tools/pydiction/complete-dict

5. 编辑配置文件

//~/.vimrc 修改当前用户配置,如果需要修改全局配置,vim /etc/vim/vimrc
# vim ~/.vimrc

let Tlist_Auto_Highlight_Tag=1
let Tlist_Auto_Open=1
let Tlist_Auto_Update=1
let Tlist_Display_Tag_Scope=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Enable_Dold_Column=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_Show_One_File=1
let Tlist_Use_Right_Window=1
let Tlist_Use_SingleClick=1
nnoremap <silent> <F8> :TlistToggle<CR>
filetype plugin on
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
let g:pydiction_location='~/.vim/tools/pydiction/complete-dict'
set autoindent
set tabstop=4
set shiftwidth=4
set expandtab
set number
set lines=35 columns=118

右边即为taglist窗口,按F8打开,使用Ctrl+w,再按w可以在code窗口和taglist窗口间切换。

以上所述是小编给大家介绍的 Ubuntu 下 vim 搭建python 环境 配置,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对【听图阁-专注于Python设计】网站的支持!

相关文章

python中for循环输出列表索引与对应的值方法

python中for循环输出列表索引与对应的值方法

如下所示: list = [‘a','b','c'] 想用for循环输出list的元素以及对应的索引。 代码及结果如下: 以上这篇python中for循环输出列表索引与对应的值...

在Python中使用AOP实现Redis缓存示例

越来越觉得的缓存是计算机科学里最NB的发明(没有之一),本文就来介绍了一下在Python中使用AOP实现Redis缓存示例,小伙伴们一起来了解一下 import redis ena...

PyQt5下拉式复选框QComboCheckBox的实例

PyQt5下拉式复选框QComboCheckBox的实例

笔者在用PyQt5写GUI时碰到了需要使用下拉式复选框的情况,但是PyQt5中没有相应的组件,而网上找到的方法大多是qt使用的,所以不能直接拿来用。 没办法,在这种让人无奈的情况下,笔者...

Python中字符串与编码示例代码

在最新的Python 3版本中,字符串是以Unicode编码的,即Python的字符串支持多语言 编码和解码    字符串在内存中以Unicode表示,在操作字符串时,经常需要...

利用Python查看微信共同好友功能的实现代码

利用Python查看微信共同好友功能的实现代码

总有思路清奇的朋友存在,想实现查看微信共同好友:   由于之前分享的代码有获取过微信好友头像,所以当时第一反应是通过itchat微信接口获取好友信息,比对两个人的好友信息列表就...