" ------------------------------------------
" vim-plug
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
" auto install vim-plu
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Graphviz
Plug 'liuchengxu/graphviz.vim'
let g:graphviz_output_format = 'svg'
" LaTeX
Plug 'lervag/vimtex', { 'for': 'latex'}
" Fortran
let fortran_free_source = 1
Plug 'rudrab/vimf90', { 'for': 'fortran'}
"Plug 'vim-scripts/fortran_line_length'
" Markdown Syntax
Plug 'plasticboy/vim-markdown', { 'for': 'markdown'}
" Markdown Preview with Mathjax Support
Plug 'iamcco/mathjax-support-for-mkdp', { 'on': 'MarkdownPreview', 'for': 'markdown'}
Plug 'iamcco/markdown-preview.vim', { 'on': 'MarkdownPreview', 'for': 'markdown'}
let g:mkdp_path_to_chrome = "/usr/bin/qutebrowser" " use qutebrowser as default preview browwer
" Syntax check
Plug 'w0rp/ale'
" SnipMate 携带的四个插件
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'
" EasyComplete 插件和 Dictionary 词表(依赖 SnipMate
Plug 'jayli/vim-easycomplete'
Plug 'jayli/vim-dictionary'
"" Code Completion
"" Require packages: build-essential cmake python3-dev
"" run `./install.py --clang-completer` after install
"function! BuildYCM(info)
" " info is a dictionary with 3 fields
" " - name: name of the plugin
" " - status: 'installed', 'updated', or 'unchanged'
" " - force: set on PlugInstall! or PlugUpdate!
" if a:info.status == 'installed' || a:info.force
" !./install.py
" endif
"endfunction
"Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM')}
" NERD tree with git status support
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
" Status Bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts = 1
let g:airline_theme='minimalist'
" Rainbow Patentheses
" Plug 'kien/rainbow_parentheses.vim'
" au VimEnter * RainbowParenthesesToggle
" au Syntax * RainbowParenthesesLoadRound
" au Syntax * RainbowParenthesesLoadSquare
" au Syntax * RainbowParenthesesLoadBraces
Plug 'luochen1990/rainbow'
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
" Initialize plugin system
call plug#end()
" -----------------------------------------
" Hollow's vim config
" Reference on https://dougblack.io/words/a-good-vimrc.html
" Colors
"colorscheme blackboard
syntax enable " enable syntax processing
" Spaces & Tabs
set tabstop=4 " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set expandtab " tabs are spaces
set shiftwidth=4 " numbers of space to indent
" UI Config
set number " show line numbers
set showcmd " show command in bottom bar
"set cursorline " highlight current line
filetype indent on " load filetype-specific indent files
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when we need to, seemed to cause latency, reference on StacksOverflow
set showmatch " highlight matching [{()}]
" Searching
set incsearch " search as characters are entered
set hlsearch " highlight matches
" turn off search highlight
nnoremap <leader><space> :nohlsearch<CR>
" Folding
set foldenable " enable folding
set foldlevelstart=10 " open most folds by defaults
set foldnestmax=10 " 10 nested fold max
" space open/closes folds
nnoremap <space> za
set foldmethod=indent " fold based on indent level(Run ':help foldmethod' for more details)
" Movement
" move vertically by visual line
nnoremap j gj
nnoremap k gk
" replacing $/^ with B/E to movr to the beginning/end of line
nnoremap B ^
nnoremap E $
nnoremap ^ <nop>
nnoremap & <nop>
" highlight last inserted text
nnoremap gV `[v`]
" Leader Shortcuts
let mapleader ="," " leader is comma
let maplocalleader = "\\" " localleader is \\
" jk is escape
"inoremap jk <esc>
" toggle gundo
nnoremap <leader>u :GundoToggle<CR>
" edit vimrc/fishrc and load vimrc bindings
nnoremap <leader>ev :vsp $MYVIMRC<CR>
nnoremap <leader>ef :vsp ~/.config/fish/config.fish
nnoremap <leader>sv :source $MYVIMRC<CR>
" save session, reopen with 'vim -S'
nnoremap <leader>s :mksession<CR>
" open ag.vim, which is a fantastic line tool to search source code without leaving Vim and pulls the results into a quickfix window
nnoremap <leader>a :Ag
" input custom symbols 『』, 「」 with ^', ^;
inoremap <F6> 『』<Esc>i
inoremap <F7> 「」<Esc>i
" txt 中文 乱码
" set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
set enc=utf8
set fencs=utf8,gbk,gb2312,gb18030
安装完插件之后启动 vim 将有如下报错:
使用的 vim 插件管理器是 vimplug .vimrc 文件:
vim version: