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中如何传递任意数量的实参的示例代码

1 用法 在定义函数时,加上这样一个形参 "*形参名",就可以传递任意数量的实参啦: def make_tags(* tags): '''为书本打标签''' print('标...

python使用opencv进行人脸识别

python使用opencv进行人脸识别

环境 ubuntu 12.04 LTS python 2.7.3 opencv 2.3.1-7 安装依赖 sudo apt-get install libopencv-* sudo...

Python的字典和列表的使用中一些需要注意的地方

Python 中有三个非常好用的数据结构,列表,元组和字典, 元组是不可变的,列表可以保存任意类型的Python对象,并可以随意扩展没有大小限制, 字典是一个key-value的键值映射...

python序列化与数据持久化实例详解

python序列化与数据持久化实例详解

本文实例讲述了python序列化与数据持久化。分享给大家供大家参考,具体如下: 数据持久化的方式有: 1.普通文件无格式写入:将数据直接写入到文件中 2.普通序列化写入:json,pic...

python中split方法用法分析

本文实例讲述了python中split方法用法。分享给大家供大家参考。具体分析如下: split 是非常重要的字符串方法,它是join的逆方法,用来将字符串分割成序列 >>...