" basic settings set ts=4 set sw=4 set cc=120 set expandtab set nu set hidden set list set autoindent set confirm set noundofile set nobackup set nowritebackup set hlsearch set noswapfile set ignorecase set smarttab set smartindent set cursorline set incsearch set signcolumn=yes set laststatus=2 set fillchars=vert:\ ,fold:- set clipboard+=unnamedplus filetype plugin indent on syntax on au! BufWritePost $MYVIMRC source % cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap inoremap inoremap inoremap inoremap inoremap inoremap inoremap noremap noremap noremap noremap vnoremap p "_dP nnoremap q :qall nnoremap 1 :b1 nnoremap 2 :b2 nnoremap 3 :b3 nnoremap 4 :b4 nnoremap 5 :b5 nnoremap w :w nnoremap :noh inoremap " trailing spaces highlight ExtraWhitespace ctermbg=red guibg=red au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red au Syntax * match ExtraWhitespace /\s\+$/ nnoremap es :%s/\s\+$//g " auto install vim-plug if has('nvim') if has('win32') let vim_plug_path = $LOCALAPPDATA . "/nvim/autoload/plug.vim" else let vim_plug_path = expand("~/.config/nvim/autoload/plug.vim") endif else let vim_plug_path = expand("~/.vim/autoload/plug.vim") endif let vim_plug_just_installed = 0 if !filereadable(vim_plug_path) echo "Installing vim-plug..." :exe "!curl -fLo " . vim_plug_path . " --create-dirs https://gitee.com/klesh/vim-plug/raw/master/plug.vim" let vim_plug_just_installed = 1 echo "vim-plug installed" endif call plug#begin() Plug 'editorconfig/editorconfig-vim' Plug 'tpope/vim-surround' Plug 'jiangmiao/auto-pairs' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'neoclide/coc-json', {'do': 'yarnpkg install --frozen-lockfile'} Plug 'iamcco/coc-vimlsp', {'do': 'yarnpkg install --frozen-lockfile'} Plug 'neoclide/coc-python', {'do': 'yarnpkg install --frozen-lockfile'} Plug 'weirongxu/coc-explorer', {'do': 'yarnpkg install --frozen-lockfile'} Plug 'liuchengxu/eleline.vim' Plug 'tpope/vim-fugitive' " git 功能 Plug 'scrooloose/nerdcommenter' Plug 'ctrlpvim/ctrlp.vim' Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] } Plug 'morhetz/gruvbox' Plug 'dag/vim-fish' call plug#end() " ==== coc configuration ==== let g:coc_disable_startup_warning = 1 nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) xmap fs (coc-format-selected) nmap fs (coc-format-selected) nmap fb (coc-format) nmap rn (coc-rename) nmap ne (coc-diagnostic-next-error) nmap pe (coc-diagnostic-prev-error) nmap fe :CocCommand explorer --toggle nmap if :CocInfo nmap cl :CocList nmap sd :call CocAction('doHover') nmap ss :syntax sync fromstart nmap ol (coc-openlink) nmap ap :call AutoPairsToggle() nnoremap sg :Grepper -tool git nnoremap sc :Grepper -tool grep " ==== fugitive configuration ==== nnoremap gs :Gstatus nnoremap gc :Gcommit nnoremap gp :Gpush nnoremap gg :Gpull nnoremap gd :Gdiff nnoremap gb :Gblame " ==== ctrlp configuration ==== let g:ctrlp_user_command = ['.git', 'git ls-files -co --exclude-standard'] " ==== gruvbox configuration ==== color gruvbox set background=dark highlight Normal ctermbg=None