Compile and upgrade Vim
Centos7.3 's own Vim is the 7.4.* version, Youcompleteme needs vim 7.4.1578+
I am here to compile and install vim8.0
# 移除旧版本sudo yum remove vim -y# 安装必要组件sudo yum install ncurses-devel python-devel -y# 下载源码编译安装git clone https://github.com/vim/vim.gitcd vim/src# 根据自己实际情况设置编译参数./configure --with-features=huge --=yes --enable-cscope --enable-fontset --with-python-config-dir=/usr/lib64/python2.7/config –enable-python3interp --with-python-config-dir=/usr/lib/python3.6/config --enable-multibyte --with-features=huge --prefix=/usr/local/vim/ make -j2 && make install
Compilation parameter Description:
- []–with-features=huge: Supports maximum features
- []–ENABLE-RUBYINTERP: Open support for Ruby-written plugins
- []–ENABLE-PYTHONINTERP: Open support for Python-written plugins
- []–ENABLE-PYTHON3INTERP: Open support for plugins written by Python3
- []–ENABLE-LUAINTERP: Open support for Lua-written plugins
- []–ENABLE-PERLINTERP: Open support for Perl-written plugins
- []–enable-multibyte: Open Multi-byte support, you can enter the Chinese in vim
- []–enable-cscope: Open support for Cscope
- []–with-python-config-dir=/usr/lib64/python2.7/config Specifies the python path
- []–with-python-config-dir=/usr/lib64/python3.5/config Specifies Python3 path
Note: You must bring Python to write plug-in support, preferably with a python path, otherwise the error will be reported in use: Youcompleteme unavailable:requires Vim compiled with Python (2.6+ or 3.6+ ) Support
After the installation is complete, Vim is installed in the/usr/local/vim/bin, adding environment variables, add the directory to the path convenient terminal global use
[[email protected] ~]# cat /etc/profile.d/vim.sh export PATH=$PATH:/usr/local/vim/bin/
View version and support information:
[[email protected] ~]# vim--versionvim-vi Improved 8.1 (2018 may, compiled 2018 03:23:45) Included Patche S:1-299compiled by [Email protected]huge version without GUI. Features included (+) or not (-): +acl +extra_search +mouse_netterm +tag_old_static+arabic +farsi +mouse_sgr-tag_any_white+autocmd +file_in_path-mouse_sysmouse-tcl+autoch Dir +find_in_path +mouse_urxvt +termguicolors-autoservername +float +mouse_xterm + Terminal-balloon_eval +folding +multi_byte +terminfo+balloon_eval_term-footer +multi_lan G +termresponse-browse +fork ()-mzscheme +textobjects++builtin_terms +gettext +NETBEANS_INTG +timers+byte_offset-hangul_input +num64 +title+channel +iconv +packages-toolbar+cindent +insert_expand+path_extra +user_commands-clientserver +job-perl +vartabs-clipboard +jump List +persistent_undo +vertsplit+cmdline_compl +keymap +postscript +virtualedit+cmdline_h ist +lambda +printer +visual+cmdline_info +langmap +profile +visualextr A+comments +libcall +python +viminfo+conceal +linebreak-python3 +VREPLACE+CRYPTV +lispindent +quickfix +wildignore+cscope +listcmds +relti Me +wildmenu+cursorbind +localmap +rightleft +windows+cursorshape-lua -ruby +writebackup+dialog_con +menu +scrollbind-x11+diff +mksessi On +signs-xfontset+digraphs +modify_fname +smartindent-xim-dnd +mo Use +startupTime-xpm-ebcdic-mouseshape +statusline-xsmp+emacs_tags +mouse_dec-sun_wo RKSHOP-XTERM_CLIPBOARD+EVAL-MOUSE_GPM +syntax-xterm_save+ex_extra-mouse_ Jsbterm +tag_binary system VIMRC File: "$VIM/vimrc" user vimrc file: "$HOME/.VIMRC" 2nd user VIMRC File: "~/.VIM/VIMRC" User exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" Fall-back for $VIM: "/ Usr/local/vim/share/vim "Compilation:gcc-std=gnu99-c-I.-iproto-dhave_config_h-g-o2-u_fortify_source-d_fortify _source=1 linking:gcc-std=gnu99-l/usr/local/lib-wl,--As-needed-o vim-lm-ltinfo-lnsl-lselinux-ld L-l/usr/lib64/python2.7/config-lpython2.7-lpthread-ldl-lutil-lm-xlinker-export-dynamic
To install the application:
pip install pep8 flake8 pyflakes isort yapf autopep8 powerline-status
Installing Vundle and Youcompleteme
Vundle is a plug-in management tool for Vim, Official document: Https://github.com/VundleVim/Vundle.vim
The installation steps are simple:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Add a color theme scheme
I use the Monokai color scheme here: Https://github.com/sickill/vim-monokai
Download the corresponding Monokai.vim file and put it in ~/.vim/colors/.
mkdir ~/.vim/colorswget -O ~/.vim/colors/monokai.vim https://raw.githubusercontent.com/sickill/vim-monokai/master/colors/monokai.vim
vim .vimrc
After emptying, change to the following:
Set Encoding=utf-8 "Remove the consistency of VI" set nocompatible "Display line number" "Set Numberset nobackupset nowbset noswapfileset noundofileset ShowCmd "Hide scroll bar" "Set Guioptions-=r" Set Guioptions-=l "set guioptions-=b" Hide Top tab Bar "set showtabline=0" set Font "" Sets Guifont=m Onaco:h13 syntax on "Turn on syntax highlighting" "Let g:solarized_termcolors=256" solarized theme settings under Terminal Settings "set Background=dark "Set Background Color" "ColorScheme roncolorscheme monokaiset nowrap" set non-wrapping "set Fileformat=unix" set save file in UNIX format "set cindent "Set C style indent format" Set tabstop=4 "setting table Length" Set Softtabstop=4set noexpandtabset shiftwidth=4 "Same as" set Showmatch "display match The parentheses "set scrolloff=5" distance from top and bottom 5 rows "set laststatus=2" command behavior two lines "Set Fenc=utf-8" File encoding "set Backspace=2set mouse=c "Enable Mouse" set Selection=exclusiveset selectmode=mouse,key "set matchtime=5set ignorecase" Ignore case "" Set Incsearchset HL Search "Highlight searches" "Set Noexpandtab" does not allow extended table "set Whichwrap+=<,>,h,lset autoread" Set Cursorline " The current line "set Cursorcolumn" is displayedOut shows the current column "" C + + partset Exrcset Secureaugroup Project autocmd! Autocmd bufread,bufnewfile *.h,*.c Set Filetype=c.doxygen autocmd bufread,bufnewfile *.hpp,*.cpp set Filetype=cpp.doxyg Enaugroup endset makeprg=make\-c\-j64nnoremap <F3>:make!<cr> "Vundlefiletype offset rtp+=~/.vim/bundle/ Vundle.vimcall vundle#begin () Plugin ' Vundlevim/vundle.vim ' Plugin ' valloric/youcompleteme ' Plugin ' lokaltog/ Vim-powerline ' Plugin ' scrooloose/nerdtree ' Plugin ' yggdroot/indentline ' Plugin ' jiangmiao/auto-pairs ' Plugin ' tell-k/ Vim-autopep8 ' Plugin ' scrooloose/nerdcommenter ' Plugin ' tagbar ' Plugin ' lokaltog/powerline ', {' RTP ': ' powerline/ bindings/vim/'}call vundle#end () filetype plugin indent on "Run Python by F5" map <F5>:autopep8<cr>:w<cr> : Call Runpython () <cr>function Runpython () to MP = &MAKEPRG let EF = &errorformat let exefile = expand ("% : T ") setlocal makeprg=python\-u set efm=%c\%.%#,%a\ \ file\ \"%f\ "\\,\ line\%l%.%#,%z%[%^\]%\ \@=%m Silent make% Copen Let &MAKEPRG = MP let &errorformat = efendfunction "Set tagbar window width let g:tagbar_width=30" map Tagbar shortcut keys, press F6 to automatically open map <F6>:tagbartoggle<cr> "Run Python Debug by F9" Map <F9>:autopep8<cr>:w<cr>: Call Runpythondebug () <cr>function Runpythondebug () Let MP = &MAKEPRG let EF = &errorformat let exefile = Expan D ("%:t") setlocal makeprg=python\-m\ pdb set efm=%c\%.%#,%a\ \ file\ \ "%f\" \\,\ line\%l%.%#,%z%[%^\]%\ \@=%m Silent make% Copen let &MAKEPRG = MP let &errorformat = efendfunction "youcompleteme" Default profile path "let G:ycm_ global_ycm_extra_conf = ' ~/.vim/bundle/youcompleteme/third_party/ycmd/examples/.ycm_extra_conf.py ' " When Vim is turned on, no longer asks whether to load ycm_extra_conf.py configuration "let G:ycm_confirm_extra_conf=0set completeopt=longest,menu" python interpreter Path "let G: Ycm_path_to_python_interpreter= '/usr/bin/python ' whether to turn on semantic completion "Let G:ycm_seed_identifiers_with_syntax=1" is also turned on in comments Let G:ycm_complete_in_comments=1let g:ycm_collect_identifiers_from_comments_and_strings = 0 "Number of characters to start the completion"Let g:ycm_min_num_of_chars_for_completion=2 "complete Auto Power off Preview window" Let G:ycm_autoclose_preview_window_after_completion=1 " Disable cache matches, regenerate matches every time "let g:ycm_cache_omnifunc=0" in the string also turns on completion "Let G:ycm_complete_in_strings = 1" Automatically closes the preview window after leaving insert mode Autocmd Insertleave * if pumvisible () = = 0|pclose|endif "Enter to select the current item" "Inoremap <expr> <CR> pumvisible ()? ' <C-y> ': ' \<cr> ' "Up and down key behavior" Inoremap <expr> <Down> pumvisible ()? ' \<c-n> ': ' \<down> ' Inoremap <expr> <Up> pumvisible ()? ' \<c-p> ': ' \<up> ' Inoremap <expr> <PageDown> pumvisible ()? ' \<pagedown>\<c-p>\<c-n> ': ' \<pagedown> ' Inoremap <expr> <PageUp> pumvisible ()? ' \<pageup>\<c-p>\<c-n> ': ' \<pageup> ' "Youcompleteme clang settingslet G:clang_format#style_ options = {\ "Accessmodifieroffset": -4, \ "Allowshortifstatementsonasingleline": "true", \ "AlwaysbreaktemplatedeclarationS ":" true ", \" standard ":" C++11 "}let g:clang_format#auto_format=1" Nerd tree "F2 open and close trees" map <F2>: NERDTR Eetoggle<cr>let nerdtreechdirmode=1 "Show bookmarks" let Nerdtreeshowbookmarks=1 "settings ignore file type" let nerdtreeignore=[' \~$ ', ' \. pyc$ ', ' \.swp$ '] "window size" let nerdtreewinsize=25 "Indent indicator line" Let g:indentline_char= ' ┆ ' let g:indentline_enabled = 1 "AUTOPEP8 Settings" Let G:autopep8_disable_show_diff=1autocmd Filetype python noremap <buffer> <F8>: Call AUTOPEP8 () <CR> Map <F4> <leader>ci <CR>
Installing plugins
Open any vim editing window and use the command mode to type the following command to achieve the corresponding function
:PluginList - 列出所有已配置的插件:PluginInstall - 安装插件,追加 `!` 用以更新或使用:PluginUpdate:PluginSearch foo - 搜索 foo ; 追加 `!` 清除本地缓存:PluginClean - 清除未使用插件,需要确认; 追加 `!` 自动批准移除未使用插件:h vundle 获取更多细节和wiki以及FAQ
or through the following quick installation:
vim +PluginInstall +qall
Additional
Add Clang: Added C language family grammar complement function
sudo yum install cmake -ycd ~/.vim/plugin/YouCompleteMe ./install.py --clang-completer
Effect
Centos7 using VIM to create a powerful Python IDE