Ubuntu 下 vim 搭建python 环境 配置

yipeiwu_com5年前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、eval In [634]: def getmethod(x,char='just f...

用pandas中的DataFrame时选取行或列的方法

如下所示: import numpy as np import pandas as pd from pandas import Sereis, DataFrame ser = Ser...

浅谈Python中的可迭代对象、迭代器、For循环工作机制、生成器

浅谈Python中的可迭代对象、迭代器、For循环工作机制、生成器

1.iterable iterator区别 要了解两者区别,先要了解一下迭代器协议: 迭代器协议是指:对象需要提供__next__()方法,它返回迭代中的元素,在没有更多元素后,抛出St...

Python代码打开本地.mp4格式文件的方法

想通过编写Python代码来打开本地的.mp4格式文件,使用os模块来操作文件。我的电脑默认的是QQ影音播放器,执行Python代码打开默认播放器,播放代码中指定的视频文件。 cla...

如何搜索查找并解决Django相关的问题

1. 卡住是怎么办 按照以下步骤, 前提是你需要懂点英文: 尽可能自己想办法解决 仔细阅读相关文档, 确保不错过任何相关内容 在Google, 百度, mailing lists或Sta...