https://github.com/all3g/pretty-vim
测试环境: Backtrack r3/ debian6 /debian7
开始之前,先上几张成功后的图片.
1. 安装vim插件管理器
Vundle是Vim bundle 的简写,它是Vim插件管理器.
Vundle允许你完成下面操作...
-
跟踪和配置
.vimrc
文件中的插件 -
安装已配置的插件(或称.scripts/bundle)
-
更新已配置的插件
-
用名字搜索所有可用的Vimscripts
-
清除无用插件
-
交互模式下简单的按键即可完成上述操作
-
介绍:
安装需要 Git,并使用git clone
将配置保存到~/.vim/bundle/
.查询需要用到Curl.
如果你使用的是 Windows,请直接查阅 Window setup.如果你遇到什么问题,请到FAQ咨询.查看Tips寻找高级配置方法.
-
安装 Vundle:
-
$git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
-
配置插件:
将下面内容置于 .vimrc
文件最上方.移除你不需要的插件,它们仅是为了演示.
-
set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'gmarik/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo " Plugin 'tpope/vim-fugitive' " plugin from http://vim-scripts.org/vim/scripts.html " Plugin 'L9' " Git plugin not hosted on GitHub " Plugin 'git://git.wincent.com/command-t.git' " git repos on your local machine (i.e. when working on your own plugin) " Plugin 'file:///home/gmarik/path/to/plugin' " The sparkup vim script is in a subdirectory of this repo called vim. " Pass the path to set the runtimepath properly. " Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " Avoid a name conflict with L9 " Plugin 'user/L9', {'name': 'newL9'} " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " To ignore plugin indent changes, instead use: " filetype plugin on " " Brief help " :PluginList - list configured plugins " :PluginInstall(!) - install (update) plugins " :PluginSearch(!) foo - search (or refresh cache first) for foo " :PluginClean(!) - confirm (or auto-approve) removal of unused plugins " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line
-
安装插件:
运行 vim
,执行:PluginInstall
或直接从命令行安装:vim +PluginInstall +qall
安装完成后, 在shell下输入vim, 检查是否有错误或者警告返回.
2. 安装插件
安装几个常用插件 NERDTree / powerline / python-mode / taglist , 详细的使用,建议阅读插件作者写的说明文档.
2.1 NERDTree 安装
cd ~/.vim/bundle/
git clone git://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
编辑 ~/.vimrc 添加下面内容:
-
"---------- NERDTree -----------
"https://github.com/scrooloose/nerdtree"autocmd vimenter * if !argc() | NERDTree |endif
autocmd vimenter * NERDTree
Plugin 'scrooloose/nerdtree'
map <F2> :NERDTreeToggle<CR>
2.2 python-mode 安装
cd ~/.vim/bundle/
git clone git://github.com/klen/python-mode.git ~/.vim/bundle/python-mode
编辑 ~/.vimrc 添加下面内容:
-
"---------- python-mode --------
Plugin 'klen/python-mode'
"Python-mode
" Activate rope
" Keys:
"K Show python docs
" <Ctrl-Space> Ropeautocomplete
" <Ctrl-c>g Rope goto definition
" <Ctrl-c>d Rope show documentation
" <Ctrl-c>f Rope find occurrences
" <Leader>b Set, unset breakpoint (g:pymode_breakpoint enabled)
"[[ Jump on previous class or function (normal, visual, operatormodes)
" ]] Jump on next class or function (normal, visual, operator modes)
"[M Jump on previous class or method (normal, visual, operatormodes)
" ]M Jump on next class or method (normal, visual, operator modes)
let g:pymode_rope = 1
"
" Documentation
let g:pymode_doc = 1
let g:pymode_doc_key = 'K'
"
"Linting
let g:pymode_lint = 1
let g:pymode_lint_checker ="pyflakes,pep8"
" Auto check on save
let g:pymode_lint_write = 1
"
" Supportvirtualenv
let g:pymode_virtualenv = 1
"
"Enable breakpoints plugin
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = '<leader>b'
"
"syntax highlighting
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors =g:pymode_syntax_all
let g:pymode_syntax_space_errors =g:pymode_syntax_all
"
" Don't autofold code
let g:pymode_folding = 0
"----------------------------------------------------------
2.3 powerline 安装
https://github.com/Lokaltog/ 下有两个版本,一个是vim-powreline, 另外一个是powerline(建议安装).
推荐阅读: http://blog.geek.be/vim-powerline-quicky/
首先检查vim是否支持python,
vim --version | grep +python
[注:]
如果后面出现下面错误,建议自行下载VIM源码编译.
sudo apt-get install python2.7-dev
./configure --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config
make && make install
从github更新powerline,不建议用vim-powerline.
apt-get install python-pip git
pip install git+git://github.com/Lokaltog/powerline
wget --no-check-certificate https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
mv PowerlineSymbols.otf /usr/share/fonts/
mv 10-powerline-symbols.conf /etc/fonts/conf.d/
fc-cache -vf
powerline安装完成后,编辑~/.vimrc 添加下面设置
set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
" Always show statusline
set laststatus=2
" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256
" (optional) use on dark background
set background=dark
2.4 taglist 安装
下载最新版本taglist, 下载地址: http://www.vim.org/scripts/script.php?script_id=273
unzip -x taglist_46.zip -d ~/.vim/
利用ctags -R -f sqlmap.tags ~/sqlmap/ , 使用下面配置,不用每次都生成tags文件, ctags会自动帮你完成.
" ------------------------------------------------------------
" taglist
let Tlist_Auto_Open=1
let Tlist_Show_One_FIle=1
let Tlist_WinWidth=40
let Tlist_Exit_OnlyWindow=1
let Tlist_Use_Right_Window=1
let Tlist_Ctags_Cmd="/usr/bin/ctags"
set autochdir
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
https://github.com/gmarik/Vundle.vim
https://github.com/scrooloose/nerdtree
https://github.com/klen/python-mode
http://unlogic.co.uk/2013/02/08/vim-as-a-python-ide/
https://github.com/Lokaltog/powerline
http://www.vim.org/scripts/script.php?script_id=273
http://blog.geek.be/vim-powerline-quicky/