歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Fedora 16 安裝 vim 以及整合部分插件(for Python)

Fedora 16 安裝 vim 以及整合部分插件(for Python)

日期:2017/2/28 15:55:01   编辑:Linux教程

在Fedora上面使用(更新)vim以及整合部分插件(for Python), 筆記如下:

0.提前准備:
0.1 'python-config' tool, Fedora提供該安裝包為'python-devel'

  1. su -c 'yum install 'python-devel''
這是為了後面准備將vim綁定python的解析器(提供auto-complete功能),
安裝成功後將會看到類似的內容:
  1. [xinz@fedora workshop]$ python-config
  2. Usage: /usr/bin/python-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help]
可以解決vim編譯時綁定解析器可能遇到的問題:

(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.
  1. ./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)

  1. " Execute file being edited with <Shift> + e:
  2. map <buffer> <S-e> :w<CR>:!/usr/bin/env python % <CR>
  3. syntax on
  4. filetype indent plugin on
  5. set modeline
  6. set tabstop=4
  7. set expandtab
  8. set softtabstop=4
  9. set shiftwidth=4
  10. set nonumber
  11. nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
  12. autocmd FileType python set omnifunc=pythoncomplete#Complete
  13. let Tlist_Ctags_Cmd='/usr/local/bin/ctags'
  14. map <leader>tt :TlistToggle<CR>
  15. set fileencodings=utf-8
  16. set termencoding=utf-8
  17. set encoding=utf-8
Copyright © Linux教程網 All Rights Reserved