1. 安装ctags
# yum install -y ctags
2. 生成tags
# cd /usr/lib/python2.6/site-packages/neutron/
# ctags -R
3. 检查vim下是否有python.vim
[root@xianghui-10-9-1-141 neutron]# find / -name "python.vim"
/usr/share/vim/vim72/ftplugin/python.vim
/usr/share/vim/vim72/syntax/python.vim
/usr/share/vim/vim72/indent/python.vim
4. 修改vim配置文件
~/.vimrc
"开启语法高亮
syntax on
"依文件类型设置自动缩进
filetype indent plugin on
"显示当前的行号列号:
set ruler
"在状态栏显示正在输入的命令
set showcmd
"关闭/打开配对括号高亮
"NoMatchParen
"set DoMatchParen
"让Vim的补全菜单行为与一般IDE一致参考VimTip1228
set completeopt+=longest
set modeline
"为深色背景调整配色
set background=dark
set filetype=python
au BufNewFile,BufRead *.py,*.pyw setf python
set autoindent " same level indent
set smartindent
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set tags=/usr/lib/python2.6/site-packages/neutron/tags,/usr/lib/python2.6/site-packages/neutron/
5. source ~/.vimrc
6. 修改bashrc
~/.bashrc
alias vi='vim'
参考来源:
http://www.cnblogs.com/samwei/archive/2011/04/25/2026211.html