在Fedora上面使用(更新)vim以及整合部分插件(for Python), 笔记如下:
0.提前准备:
0.1 'python-config' tool, Fedora提供该安装包为'python-devel'
-
su -c 'yum install 'python-devel''
安装成功后将会看到类似的内容:
-
[xinz@fedora workshop]$ python-config
Usage: /usr/bin/python-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help]
(cached) checking Python's configuration directory... (cached)
can't find it!
compile and link flags for Python are sane... no: PYTHON DISABLED
1.Fedora16默认情况下只提供一个vim-minimal精简版工具,当前下载vim7.3的src
2.解压,cd vim73
3.
-
./configure --enable-pythoninterp --enable-multibyte
说明:2个选项分别是将vim绑定python解析器,以及允许vim正常显示中文
更多对选项可以通过
./configure --help
4.make && sudo make install
安装完成后vim --version,可以查看得到+python +multi_byte
5.由于vim插件默认情况下不会被liunx/unix全部对用户使用,所以自己建立一个文件用于插件配置: ~/.vimrc。
$vim
:echo &runtimepath
将会看到vim运行时加载对配置路径
如果期望加载默认(share)插件配置,可以使用
set runtimepath+=/usr/local/share/vim/vim73
6.整理下当前使用的配置(编辑在~/.vimrc)
-
" Execute file being edited with <Shift> + e:
map <buffer> <S-e> :w<CR>:!/usr/bin/env python % <CR>
syntax on
filetype indent plugin on
set modeline
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
set nonumber
nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
autocmd FileType python set omnifunc=pythoncomplete#Complete
let Tlist_Ctags_Cmd='/usr/local/bin/ctags'
map <leader>tt :TlistToggle<CR>
set fileencodings=utf-8
set termencoding=utf-8
set encoding=utf-8