为了用上“最爽”的vim,开始了插件之旅~
插件一:pydiction(python自动补全插件)
参考资料:python自动补全
一、实现的功能
1.简单python关键词补全
2.python 函数补全带括号
3.python 模块补全
4.python 模块内函数,变量补全
5.from module import sub-module 补全
二、插件地址
1.http://vim.sourceforge.net/scripts/script.php?script_id=850
2.https://github.com/rkulla/pydiction
三、安装配置
1.文件结构
# tree ~/.vim
/root/.vim
├── after
│ └── ftplugin
│ └── python_pydiction.vim
└── tools
└── pydiction
└── complete-dict
2.下载安装
git clone https://github.com/rkulla/pydiction.git
cd pydiction
mkdir -p ~/.vim/tools/pydiction
cp -r pydiction/after ~/.vim
cp pydiction/complete-dict ~/.vim/tools/pydiction //也可以参照pydiction的ReadMe进行安装(此安装方法就是ReadMe中提取出来的)
3.新建.vimrc,写入一下内容(也可以写入/etc/vimrc或者/etc/vim/vimrc)
# cat ~/.vimrc
filetype plugin on
let g:pydiction_location = '~/.vim/tools/pydiction/complete-dict'
然后就可以自动补全了
插件二:大YouCompleteMe
一、介绍
这个插件简直是神器的感觉(大家都这么说的),自己安装完后用了小,简直了!但是安装她的前提是大于7.3的vim版本,并且还要可以支持python的。
二、安装
1.安装vundle
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
set nocompatible " be iMproved
set nu
set noswapfile
syntax on
set backspace=2
set tabstop=2
set shiftwidth=2
set completeopt=menu
:colorscheme ron
set cindent
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Valloric/YouCompleteMe'
Bundle 'scrooloose/syntastic'
""""""""""syntastic""""""""""""
let g:syntastic_check_on_open = 1
let g:syntastic_cpp_include_dirs = ['/usr/include/']
let g:syntastic_cpp_remove_include_errors = 1
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_compiler = 'clang++'
"set error or warning signs
let g:syntastic_error_symbol = 'x'
let g:syntastic_warning_symbol = '!'
"whether to show balloons
let g:syntastic_enable_balloons = 1
""""""""""""YCM""""""""""""""""""""
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_confirm_extra_conf = 0
3.打开vim,输入:BundleInstall,开始安装YouCompleteMe
4.编译开始(此按照官方给的ReadMe文档安装的)
cd ~
mkdir ~/ycm_build
cd ~/ycm_build
//接着安装g++,因为后边编译会用到,不然会出错
//fedora等下
dnf install gcc-c++
//Ubntu等下
apt-get install g++
cmake -G "Unix Makefiles" ~/.vim/bundle/YouCompleteMe/cpp -DEXTERNAL_LIBCLANG_PATH=/lib/libclang.so
make ycm_support_libs
5.安装完成(也可以选择安装libclang,具体的根据文档来弄即可,虽然只是英文的,但是不难理解)