vim

1. vim

1.1. https://www.vim.org

1.2. https://neovim.io

1.3. https://spacevim.org

Mobile Preview

Mobile Preview

Mobile Preview

2. build

  • 安装依赖
    yum -y install python-devel
    yum -y install ncurses-devel
    
  • 拉取代码 编译 安装
    git clone https://github.com/vim/vim
    pushd vim
    git submodule update --init --recursive
    make distclean
    sh configure --help
    sh configure --enable-pythoninterp=yes --enable-cscope  --enable-multibyte --enable-fontset
    make
    sudo make install
    popd
    
  • 卸载
    sudo make uninstall
    

3. SpaceVim

  • 安装
    curl -sLf https://spacevim.org/install.sh | bash
    
  • 卸载
    curl -sLf https://spacevim.org/install.sh | bash -s -- --uninstall
    

4. 安装插件

  • 基础依赖
    yum -y automake gcc gcc-c++ kernel-devel cmake
    yum -y install python-dev python3-dev boost clang-devel
    
  • 安装bundle ``` pushd ~/ mkdir .vim mkdir .vim/bundle

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim cd ~/.vim/bundle


- 安装YouCompleteMe

git clone https://github.com/brinkqiang/YouCompleteMe cd YouCompleteMe git submodule update –init –recursive sh install.sh –help sh install.sh –all popd

cp ~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py ~/ cp ~/.vim/bundle/YouCompleteMe/.vimrc ~/

# 5. vim设置
vim ~/.vimrc

set nocompatible “ be iMproved, required filetype off “ required

” set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

Plugin ‘VundleVim/Vundle.vim’ Plugin ‘Valloric/YouCompleteMe’ Plugin ‘jnurmine/Zenburn’ Plugin ‘octol/vim-cpp-enhanced-highlight’

Plugin ‘vim-scripts/gdbmgr’ Plugin ‘honza/vim-snippets’ Plugin ‘scrooloose/nerdtree’

call vundle#end() “ required

” “ Brief help “ :PluginList - lists configured plugins “ :PluginInstall - installs plugins; append ! to update or just :PluginUpdate “ :PluginSearch foo - searches for foo; append ! to refresh local cache “ :PluginClean - confirms removal of unused plugins; append ! to auto-approve removal “ “ see :h vundle for more details or wiki for FAQ “ Put your non-Plugin stuff after this line

” set nocompatible

set backspace=indent,eol,start set nobackup set history=1500 set ruler set showcmd

set t_Co=256

set showmatch set hlsearch set incsearch set ignorecase

syntax on filetype plugin indent on autocmd FileType text setlocal

set autoindent set cindent set number set expandtab set tabstop=2 set shiftwidth=2

set encoding=utf-8 set fileencoding=utf-8 set fileencodings=utf-8,gb2312

au BufReadPost * if line(“’"”) > 0 if line(“’"”) <= line(“$”) exe(“norm ‘"”) else exe “norm $” endif endif

set completeopt=longest,menu autocmd InsertLeave * if pumvisible() == 0|pclose|endif inoremap pumvisible() ? "\" : "\"

inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\\\" : "\" inoremap pumvisible() ? "\\\" : "\"

“let g:ycm_key_list_select_completion=[‘'] let g:ycm_key_list_select_completion = [''] "let g:ycm_key_list_previous_completion=[''] let g:ycm_key_list_previous_completion = [''] let g:ycm_confirm_extra_conf=0

let g:ycm_collect_identifiers_from_tags_files=1 let g:ycm_min_num_of_chars_for_completion=2 let g:ycm_cache_omnifunc=0 let g:ycm_seed_identifiers_with_syntax=1 nnoremap :YcmForceCompileAndDiagnostics "force recomile with syntastic "nnoremap lo :lopen "open locationlist "nnoremap lc :lclose "close locationlist inoremap

let g:ycm_complete_in_comments = 1

let g:ycm_complete_in_strings = 1

let g:ycm_collect_identifiers_from_comments_and_strings = 0

let g:ycm_echo_current_diagnostic = 1

let g:ycm_auto_trigger = 1

nnoremap jd :YcmCompleter GoToDefinitionElseDeclaration

nmap <C-]> :YcmCompleter GoToDefinitionElseDeclaration imap <C-]> :YcmCompleter GoToDefinitionElseDeclaration

autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow

let g:clang_format_fallback_style=’~/.clang-format’ let g:ycm_server_python_interpreter=’/usr/bin/python’ let g:ycm_global_ycm_extra_conf=’~/.ycm_extra_conf.py’

map :call CompileRunGcc() map :NERDTree map :PluginInstall

if has(‘gui_running’) set background=dark colorscheme solarized else colorscheme zenburn endif

func! CompileRunGcc() exec “w” if &filetype == ‘c’ exec ‘!g++ % -o %<’ exec ‘!./%<’ elseif &filetype == ‘cc’ exec ‘!g++ % -o %<’ exec ‘!./%<’ elseif &filetype == ‘cpp’ exec ‘!g++ % -o %<’ exec ‘!./%<’ elseif &filetype == ‘python’ exec ‘!python %<’ elseif &filetype == ‘sh’ :!bash % endif endfunc ```