1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Simplify init.vim

This commit is contained in:
jdhao 2019-05-07 01:06:41 +08:00
parent a96bc3b527
commit aeb3456f23

228
init.vim
View File

@ -20,7 +20,7 @@
" not recommend downloading this file and replace your own init.vim. Good " not recommend downloading this file and replace your own init.vim. Good
" configurations are built over time and take your time to polish. " configurations are built over time and take your time to polish.
" Author: jdhao (jdhao@hotmail.com). Blog: https://jdhao.github.io " Author: jdhao (jdhao@hotmail.com). Blog: https://jdhao.github.io
" Update: 2019-05-05 22:47:43+0800 " Update: 2019-05-06 21:53:28+0800
"}} "}}
"{{ License: MIT License "{{ License: MIT License
@ -192,26 +192,23 @@ endfunction
set fillchars=fold:\ ,vert:\| set fillchars=fold:\ ,vert:\|
" paste mode toggle, it seems that neovim's bracketed paste mode " paste mode toggle, it seems that neovim's bracketed paste mode
" does not work very well for nvim-qt, so we use old paste mode " does not work very well for nvim-qt, so we use good-old paste mode
set pastetoggle=<F12> set pastetoggle=<F12>
" set cursorline " whether to show current line cursor is in " split window below/right when creating horizontal/vertical windows
" split window below when creating horizontal window and split right when
" creating vertical window
set splitbelow set splitbelow
set splitright set splitright
" Time in milliseconds to wait for a mapped sequence to complete " Time in milliseconds to wait for a mapped sequence to complete
" see https://goo.gl/vHvyu8 for more info " see https://goo.gl/vHvyu8 for more info
set timeoutlen=300 set timeoutlen=800
set updatetime=1000 " speed up updatetime so changes show quicker
" clipboard settings, always use clipboard for all delete, yank, change, put " clipboard settings, always use clipboard for all delete, yank, change, put
" operation, see https://goo.gl/YAHBbJ " operation, see https://goo.gl/YAHBbJ
set clipboard+=unnamedplus set clipboard+=unnamedplus
" disable creating swapfiles, see https://goo.gl/FA6m6h set noswapfile " disable creating swapfiles, see https://goo.gl/FA6m6h
set noswapfile
" general tab settings " general tab settings
set tabstop=4 " number of visual spaces per TAB set tabstop=4 " number of visual spaces per TAB
@ -220,18 +217,17 @@ set shiftwidth=4 " number of spaces to use for autoindent
set expandtab " expand tab to spaces so that tabs are spaces set expandtab " expand tab to spaces so that tabs are spaces
set showmatch " highlight matching bracket set showmatch " highlight matching bracket
set matchpairs+=<:>,「:」 " matching pairs of characters
" show line number and relative line number " show line number and relative line number
set number relativenumber set number relativenumber
" ignore case when searching but become case sensitive when uppercase " ignore case in general, but become case-sensitive when uppercase present
" characters are present
set ignorecase smartcase set ignorecase smartcase
" encoding settings for vim " encoding settings for vim
set fileencoding=utf-8 set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
scriptencoding utf-8 " set the script encoding (`:h :scriptencoding`) scriptencoding utf-8 " set the script encoding (`:h :scriptencoding`)
set linebreak " line will break at predefined characters set linebreak " line will break at predefined characters
@ -239,8 +235,8 @@ set linebreak " line will break at predefined characters
" list all items and start selecting matches " list all items and start selecting matches
set wildmode=list:longest,full set wildmode=list:longest,full
" set a ruler at column 80, see https://goo.gl/vEkF5i set cursorline " whether to show current line cursor is in
set colorcolumn=80 set colorcolumn=80 " set a ruler at column 80, see https://goo.gl/vEkF5i
set scrolloff=5 " minimum lines to keep above and below cursor set scrolloff=5 " minimum lines to keep above and below cursor
@ -293,11 +289,6 @@ set autowrite " auto write the file based on some condition
set title set title
set titlestring=%{hostname()}\ \ %F\ \ \ %{strftime('%Y-%m-%d\ %H:%M',getftime(expand('%')))} set titlestring=%{hostname()}\ \ %F\ \ \ %{strftime('%Y-%m-%d\ %H:%M',getftime(expand('%')))}
set updatetime=1000 " speed up updatetime so changes show quicker
" whether to use modeline, see also https://is.gd/FEzuc7.
set modeline
set undofile " persistent undo even after you close and file and reopen it set undofile " persistent undo even after you close and file and reopen it
" do not show "match xx of xx" and other messages during auto-completion " do not show "match xx of xx" and other messages during auto-completion
@ -305,9 +296,13 @@ set shortmess+=c
set completeopt+=noinsert " auto select the first completion entry set completeopt+=noinsert " auto select the first completion entry
set completeopt+=menuone " show menu even if there is only one item set completeopt+=menuone " show menu even if there is only one item
" disable the preview window during autocompletion, see also https://goo.gl/18zNPD " disable the preview window, see also https://goo.gl/18zNPD
set completeopt-=preview set completeopt-=preview
" settings for popup menu
set pumheight=15 " maximum number of items to show in popup menu
set pumblend=10 " pesudo-blend effect for popup menu
" scan files given by `dictionary` option " scan files given by `dictionary` option
set complete+=k,kspell complete-=w complete-=b complete-=u complete-=t set complete+=k,kspell complete-=w complete-=b complete-=u complete-=t
@ -328,61 +323,49 @@ set formatoptions+=mM
" dictionary files for different systems " dictionary files for different systems
let $MY_DICT = stdpath('config') . '/dict/words' let $MY_DICT = stdpath('config') . '/dict/words'
set dictionary+=$MY_DICT set dictionary+=$MY_DICT
set spelllang=en,cjk " spell languages set spelllang=en,cjk " spell languages
set lazyredraw set lazyredraw
" matching pairs of characters
set matchpairs+=<:>,「:」
" popup menu settings
set pumheight=15 " maximum number of items to show in popup menu
set pumblend=15 " pesudo-blend effect for popup menu
" tilde ~ is an operator (thus must be followed by motion like `c` or `d`) " tilde ~ is an operator (thus must be followed by motion like `c` or `d`)
set tildeop set tildeop
"} "}
"{ Custom key mappings "{ Custom key mappings
" save key strokes (now we do not need to press shift to enter command mode) " save key strokes (now we do not need to press shift to enter command mode)
" vim-sneak has also mapped ;, so using the below mapping will break the map
" used by vim-sneak
nnoremap ; : nnoremap ; :
vnoremap ; :
" quick way to open command window " quick way to open command window
nnoremap q; q: nnoremap q; q:
" custom ESC. I do not like `kk` because it will delay the vim default `k` " quicker <Esc> in insert mode, you must pick a rarely used character
" motion by `timeoutlen` milliseconds (see `:h timeoutlen` for more info) " combination
inoremap <silent> <leader>k <ESC> inoremap <silent> jk <Esc>
" use sane regex expression (see `:h magic` for more info) " use sane regex expression (see `:h magic` for more info)
nnoremap / /\v nnoremap / /\v
vnoremap / /\v
" paste text above or below current cursor, see " paste non-linewise text above or below current cursor,
" https://stackoverflow.com/a/1346777/6064933 " see https://stackoverflow.com/a/1346777/6064933
nnoremap <leader>p o<ESC>p nnoremap <leader>p m`o<ESC>p``
nnoremap <leader>P O<ESC>p nnoremap <leader>P m`O<ESC>p``
" shortcut for faster save and quit " shortcut for faster save and quit
nmap <silent> <leader>w :w<CR> nmap <silent> <leader>w :update<CR>
" saves the file if modified and quit " saves the file if modified and quit
nnoremap <silent> <leader>q :x<CR> nnoremap <silent> <leader>q :x<CR>
" quit all opened buffers " quit all opened buffers
nnoremap <silent> <leader>Q :qa<CR> nnoremap <silent> <leader>Q :qa<CR>
" go to previous and next item in location list " navigation in the location and quickfix list
nnoremap [l :lprevious<CR>zv nnoremap [l :lprevious<CR>zv
nnoremap ]l :lnext<CR>zv nnoremap ]l :lnext<CR>zv
" go to first and last item in location list (less used)
nnoremap [L :lfirst<CR>zv nnoremap [L :lfirst<CR>zv
nnoremap ]L :llast<CR>zv nnoremap ]L :llast<CR>zv
" go to previous and next item in quickfix list
nnoremap [q :cprevious<CR>zv nnoremap [q :cprevious<CR>zv
nnoremap ]q :cnext<CR>zv nnoremap ]q :cnext<CR>zv
" go to first and last item in quickfix list
nnoremap [Q :cfirst<CR>zv nnoremap [Q :cfirst<CR>zv
nnoremap ]Q :clast<CR>zv nnoremap ]Q :clast<CR>zv
@ -460,12 +443,8 @@ inoremap <expr> <cr> ((pumvisible())?("\<C-Y>"):("\<cr>"))
" use <esc> to close auto-completion menu " use <esc> to close auto-completion menu
inoremap <expr> <esc> ((pumvisible())?("\<C-e>"):("\<esc>")) inoremap <expr> <esc> ((pumvisible())?("\<C-e>"):("\<esc>"))
" switching buffers quickly, extracted from vim-unimpaired
nnoremap <silent> [b :bprevious<cr> " go to previous buffer
nnoremap <silent> ]b :bnext<cr> " go to next buffer
" reload init.vim quickly and give a message " reload init.vim quickly and give a message
nnoremap <silent> <leader>sv :source $MYVIMRC<cr> nnoremap <silent> <leader>sv :update $MYVIMRC<cr>:source $MYVIMRC<cr>
\ :echom "Nvim config successfully reloaded!"<cr> \ :echom "Nvim config successfully reloaded!"<cr>
" edit init.vim in a vertical split " edit init.vim in a vertical split
@ -613,13 +592,11 @@ endif
" Windows 10 build 17063, source: http://tinyurl.com/y23972tt) " Windows 10 build 17063, source: http://tinyurl.com/y23972tt)
" The following script to install vim-plug are adapted from " The following script to install vim-plug are adapted from
" vim-plug tips: https://bit.ly/2IhJDNb " vim-plug tips: https://bit.ly/2IhJDNb
if !executable('curl') if !executable('curl')
echoerr 'You have to install curl to install vim-plug or install vim-plug echoerr 'You have to install curl to install vim-plug or install vim-plug
\ yourself following the guide on vim-plug git repository' \ yourself following the guide on vim-plug git repository'
execute 'q!' execute 'q!'
else else
if has('unix') if has('unix')
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
echo 'Installing Vim-plug on your system' echo 'Installing Vim-plug on your system'
@ -648,15 +625,13 @@ else
endif endif
"} "}
call plug#begin(s:PLUGIN_HOME)
"{{ autocompletion related plugins "{{ autocompletion related plugins
call plug#begin(s:PLUGIN_HOME)
" settings for deoplete " settings for deoplete
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" snippet engine " snippet engine and snippet template
Plug 'SirVer/ultisnips' Plug 'SirVer/ultisnips'
" snippet template for ultisnips
Plug 'honza/vim-snippets' Plug 'honza/vim-snippets'
" for insert mode completion " for insert mode completion
@ -668,11 +643,7 @@ Plug 'zchee/deoplete-jedi', { 'for': 'python' }
" vim source for deoplete " vim source for deoplete
Plug 'Shougo/neco-vim', { 'for': 'vim' } Plug 'Shougo/neco-vim', { 'for': 'vim' }
" dictionary source for English words completion (not available on Windows) " for English word auto-completion
" Find this plugin on http://tinyurl.com/gttcxwh
if has('unix')
" Plug 'ujihisa/neco-look'
endif
Plug 'deathlyfrantic/deoplete-spell' Plug 'deathlyfrantic/deoplete-spell'
"}} "}}
@ -681,7 +652,7 @@ Plug 'deathlyfrantic/deoplete-spell'
Plug 'davidhalter/jedi-vim', { 'for': 'python' } Plug 'davidhalter/jedi-vim', { 'for': 'python' }
" Python syntax highlighting " Python syntax highlighting
Plug 'vim-python/python-syntax', { 'for': 'python' } " Plug 'vim-python/python-syntax', { 'for': 'python' }
" python syntax highlighting and more " python syntax highlighting and more
Plug 'numirias/semshi', { 'do': ':UpdateRemotePlugins', 'for': 'python' } Plug 'numirias/semshi', { 'do': ':UpdateRemotePlugins', 'for': 'python' }
@ -694,12 +665,6 @@ Plug 'Vimjas/vim-python-pep8-indent', {'for': 'python'}
"}} "}}
"{{ search related plugins "{{ search related plugins
" extend vim's default search behaviour
Plug 'inkarkat/vim-SearchHighlighting'
" required by vim-SearchHighlighting
Plug 'inkarkat/vim-ingo-library'
" super fast movement with vim-sneak " super fast movement with vim-sneak
Plug 'justinmk/vim-sneak' Plug 'justinmk/vim-sneak'
@ -709,6 +674,9 @@ Plug 'haya14busa/is.vim'
" show match number for incsearch " show match number for incsearch
Plug 'osyo-manga/vim-anzu' Plug 'osyo-manga/vim-anzu'
" stay after pressing * and search selected text
Plug 'haya14busa/vim-asterisk'
" another grep tool (similar to Sublime Text Ctrl+Shift+F) " another grep tool (similar to Sublime Text Ctrl+Shift+F)
" TODO: worth trying and exploring " TODO: worth trying and exploring
Plug 'dyng/ctrlsf.vim' Plug 'dyng/ctrlsf.vim'
@ -745,15 +713,10 @@ Plug 'ajmwagar/vim-deus'
" Plug 'rakr/vim-one' " Plug 'rakr/vim-one'
" Plug 'kaicataldo/material.vim' " Plug 'kaicataldo/material.vim'
" wonderful status line " colorful status line and theme
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
" vim-airline theme
Plug 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline-themes'
" lightline status bar (a simpler alternative to vim-airline)
" Plug 'itchyny/lightline.vim'
" show indent lines for better comprehension of the code structure " show indent lines for better comprehension of the code structure
" currently, blank lines inside the indent block do not show indent guides, " currently, blank lines inside the indent block do not show indent guides,
" see https://github.com/Yggdroot/indentLine/issues/25 " see https://github.com/Yggdroot/indentLine/issues/25
@ -768,7 +731,7 @@ Plug 'mhinz/vim-startify'
Plug 'itchyny/vim-highlighturl' Plug 'itchyny/vim-highlighturl'
" For Windows and Mac, we can open URL in browser. For Linux, it may not be " For Windows and Mac, we can open URL in browser. For Linux, it may not be
" possible since we maybe in a server which disable X11 " possible since we maybe in a server which disables GUI
if has('win32') || has('macunix') if has('win32') || has('macunix')
" open URL in browser " open URL in browser
Plug 'tyru/open-browser.vim' Plug 'tyru/open-browser.vim'
@ -781,7 +744,6 @@ Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
" only install these plugins if ctags are installed on the system " only install these plugins if ctags are installed on the system
if executable('ctags') if executable('ctags')
" plugin to manage tags (must install ctags on system) " plugin to manage tags (must install ctags on system)
Plug 'ludovicchabant/vim-gutentags' Plug 'ludovicchabant/vim-gutentags'
@ -797,10 +759,6 @@ Plug 'jiangmiao/auto-pairs'
" comment plugin " comment plugin
Plug 'scrooloose/nerdcommenter' Plug 'scrooloose/nerdcommenter'
" multiline editting plugin. It becomes slow if you try to edit many
" occurences of a variable
" Plug 'terryma/vim-multiple-cursors'
" another multiple cursor plugin " another multiple cursor plugin
" Plug 'mg979/vim-visual-multi' " Plug 'mg979/vim-visual-multi'
@ -838,6 +796,12 @@ Plug 'kshenoy/vim-signature'
" handy unix command inside Vim " handy unix command inside Vim
Plug 'tpope/vim-eunuch' Plug 'tpope/vim-eunuch'
" show the content of register in preview window
" Plug 'junegunn/vim-peekaboo'
if has('macunix')
Plug 'rlue/vim-barbaric'
endif
"}} "}}
"{{ linting, formating "{{ linting, formating
@ -1033,7 +997,6 @@ call deoplete#custom#option('auto_complete', v:true)
" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>" " inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
"""""""""""""""""""""""""UltiSnips settings""""""""""""""""""" """""""""""""""""""""""""UltiSnips settings"""""""""""""""""""
" Trigger configuration. Do not use <tab> if you use " Trigger configuration. Do not use <tab> if you use
" https://github.com/Valloric/YouCompleteMe. " https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger='<tab>' let g:UltiSnipsExpandTrigger='<tab>'
@ -1049,7 +1012,6 @@ let g:UltiSnipsJumpBackwardTrigger='<c-k>'
let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets'] let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
"""""""""""""""""""""""""supertab settings"""""""""""""""""""""""""" """""""""""""""""""""""""supertab settings""""""""""""""""""""""""""
" auto-close method preview window " auto-close method preview window
"let g:SuperTabClosePreviewOnPopupClose = 1 "let g:SuperTabClosePreviewOnPopupClose = 1
@ -1062,7 +1024,6 @@ let g:SuperTabMappingForward = '<tab>'
let g:SuperTabMappingBackward = '<s-tab>' let g:SuperTabMappingBackward = '<s-tab>'
""""""""""""""""""deoplete-jedi settings""""""""""""""""""""""""""" """"""""""""""""""deoplete-jedi settings"""""""""""""""""""""""""""
" whether to show doc string " whether to show doc string
let g:deoplete#sources#jedi#show_docstring = 0 let g:deoplete#sources#jedi#show_docstring = 0
@ -1075,7 +1036,6 @@ let g:deoplete#sources#jedi#server_timeout = 50
"{{ python-related "{{ python-related
""""""""""""""""""""""""jedi-vim settings""""""""""""""""""" """"""""""""""""""""""""jedi-vim settings"""""""""""""""""""
" disable autocompletion, because I use deoplete for auto-completion " disable autocompletion, because I use deoplete for auto-completion
let g:jedi#completions_enabled = 0 let g:jedi#completions_enabled = 0
@ -1086,7 +1046,6 @@ let g:jedi#completions_enabled = 0
let g:jedi#show_call_signatures = '2' let g:jedi#show_call_signatures = '2'
"""""""""""""""""""""""""python-syntax highlight settings""""""""""""""""""" """""""""""""""""""""""""python-syntax highlight settings"""""""""""""""""""
" highlight all " highlight all
let g:python_highlight_all = 1 let g:python_highlight_all = 1
@ -1094,7 +1053,6 @@ let g:python_highlight_all = 1
let g:python_highlight_space_errors = 0 let g:python_highlight_space_errors = 0
"""""""""""""""""""""""""" semshi settings """"""""""""""""""""""""""""""" """""""""""""""""""""""""" semshi settings """""""""""""""""""""""""""""""
" do not highlight variable under cursor " do not highlight variable under cursor
let g:semshi#mark_selected_nodes=0 let g:semshi#mark_selected_nodes=0
@ -1104,15 +1062,19 @@ let g:semshi#error_sign=v:false
"{{ search related "{{ search related
"""""""""""""""""""""""""""""vim-sneak settings""""""""""""""""""""""" """""""""""""""""""""""""""""vim-sneak settings"""""""""""""""""""""""
let g:sneak#label = 1 let g:sneak#label = 1
nmap f <Plug>Sneak_s nmap f <Plug>Sneak_s
xmap f <Plug>Sneak_s
omap f <Plug>Sneak_s
nmap F <Plug>Sneak_S nmap F <Plug>Sneak_S
nmap t <Plug>Sneak_t xmap F <Plug>Sneak_S
nmap T <Plug>Sneak_T omap F <Plug>Sneak_S
" immediately after entering sneak mode, you can press f and F to go to next
" or previous match
let g:sneak#s_next = 1
""""""""""""""""""""""""""""is.vim settings""""""""""""""""""""""" """"""""""""""""""""""""""""is.vim settings"""""""""""""""""""""""
" to make is.vim work together well with vim-anzu and put current match in " to make is.vim work together well with vim-anzu and put current match in
" the center of the window " the center of the window
" `zz`: put cursor line in center of the window " `zz`: put cursor line in center of the window
@ -1121,20 +1083,21 @@ nmap n <Plug>(is-nohl)<Plug>(anzu-n-with-echo)zzzv
nmap N <Plug>(is-nohl)<Plug>(anzu-N-with-echo)zzzv nmap N <Plug>(is-nohl)<Plug>(anzu-N-with-echo)zzzv
"""""""""""""""""""""""""""""vim-anzu settings""""""""""""""""""""""" """""""""""""""""""""""""""""vim-anzu settings"""""""""""""""""""""""
" do not show search index in statusline since it is shown on command line
let g:airline#extensions#anzu#enabled = 0
" nmap n zzzv<Plug>(anzu-n-with-echo) " maximum number of words to search
" nmap N zzzv<Plug>(anzu-N-with-echo) let g:anzu_search_limit = 500000
nmap * <Plug>(anzu-star-with-echo)
nmap # <Plug>(anzu-sharp-with-echo)
" clear matching info on status line with double <Esc> """""""""""""""""""""""""""""vim-asterisk settings"""""""""""""""""""""
nmap <Esc><Esc> <Plug>(anzu-clear-search-status) nmap * <Plug>(asterisk-z*)<Plug>(is-nohl-1)<Plug>(anzu-star-with-echo)
nmap g* <Plug>(asterisk-gz*)<Plug>(is-nohl-1)
nmap # <Plug>(asterisk-z#)<Plug>(is-nohl-1)<Plug>(anzu-sharp-with-echo)
nmap g# <Plug>(asterisk-gz#)<Plug>(is-nohl-1)
"""""""""""""""""""""""""fzf settings"""""""""""""""""""""""""" """""""""""""""""""""""""fzf settings""""""""""""""""""""""""""
" only use fzf on Mac and Linux, since it doesn't work well for Windows " only use fzf on Mac and Linux, since it doesn't work well for Windows
if has('unix') if has('unix')
" hide status line when open fzf window " hide status line when open fzf window
augroup fzf_hide_statusline augroup fzf_hide_statusline
autocmd! autocmd!
@ -1150,7 +1113,6 @@ if has('unix')
" nnoremap <silent> <leader>F :FZF ~<cr> " nnoremap <silent> <leader>F :FZF ~<cr>
"""""""""""""""""""""""""fzf.vim settings"""""""""""""""""" """""""""""""""""""""""""fzf.vim settings""""""""""""""""""
" Customize fzf colors to match your color scheme " Customize fzf colors to match your color scheme
let g:fzf_colors = let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'], \ { 'fg': ['fg', 'Normal'],
@ -1211,7 +1173,6 @@ endif
"{{ URL related "{{ URL related
""""""""""""""""""""""""""""open-browser.vim settings""""""""""""""""""" """"""""""""""""""""""""""""open-browser.vim settings"""""""""""""""""""
if has('win32') || has('macunix') if has('win32') || has('macunix')
" disable netrw's gx mapping. " disable netrw's gx mapping.
let g:netrw_nogx = 1 let g:netrw_nogx = 1
@ -1222,13 +1183,11 @@ if has('win32') || has('macunix')
endif endif
"""""""""""""""""""""""""vim-highlighturl settings""""""""""""""""""""""""" """""""""""""""""""""""""vim-highlighturl settings"""""""""""""""""""""""""
" whether to underline the URL " whether to underline the URL
let g:highlighturl_underline=1 let g:highlighturl_underline=1
"{{ navigation and tags "{{ navigation and tags
""""""""""""""""""""""" nerdtree settings """""""""""""""""""""""""" """"""""""""""""""""""" nerdtree settings """"""""""""""""""""""""""
" toggle nerdtree window and keep cursor in file window, " toggle nerdtree window and keep cursor in file window,
" adapted from http://tinyurl.com/y2kt8cy9 " adapted from http://tinyurl.com/y2kt8cy9
nnoremap <silent> <Space>s :NERDTreeToggle<CR>:wincmd p<CR> nnoremap <silent> <Space>s :NERDTreeToggle<CR>:wincmd p<CR>
@ -1262,14 +1221,12 @@ let NERDTreeStatusline="%{exists('b:NERDTree')?fnamemodify(b:NERDTree.root.path.
let NERDTreeMinimalUI=0 let NERDTreeMinimalUI=0
""""""""""""""""""""""""""" tagbar settings """""""""""""""""""""""""""""""""" """"""""""""""""""""""""""" tagbar settings """"""""""""""""""""""""""""""""""
" shortcut to toggle tagbar window " shortcut to toggle tagbar window
nnoremap <silent> <Space>t :TagbarToggle<CR> nnoremap <silent> <Space>t :TagbarToggle<CR>
"}} "}}
"{{ file editting "{{ file editting
"""""""""""""""""""""""""""""auto-pairs settings""""""""""""""""""""""""" """""""""""""""""""""""""""""auto-pairs settings"""""""""""""""""""""""""
augroup filetype_custom_autopair augroup filetype_custom_autopair
autocmd! autocmd!
" only use the following character pairs for tex file " only use the following character pairs for tex file
@ -1283,7 +1240,6 @@ autocmd!
augroup END augroup END
""""""""""""""""""""""""""""nerdcommenter settings""""""""""""""""""" """"""""""""""""""""""""""""nerdcommenter settings"""""""""""""""""""
" Add spaces after comment delimiters by default " Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1 let g:NERDSpaceDelims = 1
@ -1299,7 +1255,6 @@ let g:NERDDefaultAlign = 'left'
let g:NERDToggleCheckAllLines = 1 let g:NERDToggleCheckAllLines = 1
""""""""""""""""""""""""""""vim-titlecase settings""""""""""""""""""""""" """"""""""""""""""""""""""""vim-titlecase settings"""""""""""""""""""""""
" do not use the default mapping provided " do not use the default mapping provided
let g:titlecase_map_keys = 0 let g:titlecase_map_keys = 0
@ -1308,20 +1263,17 @@ vmap <leader>gt <Plug>Titlecase
nmap <leader>gT <Plug>TitlecaseLine nmap <leader>gT <Plug>TitlecaseLine
""""""""""""""""""""""""vim-auto-save settings""""""""""""""""""""""" """"""""""""""""""""""""vim-auto-save settings"""""""""""""""""""""""
" enable autosave on nvim startup
" enable AutoSave on nvim startup
let g:auto_save = 1 let g:auto_save = 1
" the event to trigger autosave " a list of events to trigger autosave
let g:auto_save_events = ['InsertLeave', 'TextChanged'] let g:auto_save_events = ['InsertLeave']
" show autosave status on command line " show autosave status on command line
let g:auto_save_silent = 0 let g:auto_save_silent = 0
""""""""""""""""""""""""""""vim-yoink settings""""""""""""""""""""""""" """"""""""""""""""""""""""""vim-yoink settings"""""""""""""""""""""""""
if has('win32') || has('macunix')
if has('win32')
" TODO: test yoink on Mac to see if it works
" it seems that ctrl-n and ctrl-p does not work on neovim " it seems that ctrl-n and ctrl-p does not work on neovim
nmap <c-n> <plug>(YoinkPostPasteSwapBack) nmap <c-n> <plug>(YoinkPostPasteSwapBack)
nmap <c-p> <plug>(YoinkPostPasteSwapForward) nmap <c-p> <plug>(YoinkPostPasteSwapForward)
@ -1345,7 +1297,6 @@ if has('win32')
endif endif
"""""""""""""""""""""vim-better-whitespace settings"""""""""""""""""""""""""" """""""""""""""""""""vim-better-whitespace settings""""""""""""""""""""""""""
" whether to highlight trailing whitespace with the default red color (I find " whether to highlight trailing whitespace with the default red color (I find
" it distracting so I turn it off) " it distracting so I turn it off)
let g:better_whitespace_enabled=0 let g:better_whitespace_enabled=0
@ -1360,7 +1311,6 @@ let g:strip_whitelines_at_eof=1
let g:better_whitespace_operator='' let g:better_whitespace_operator=''
""""""""""""""""""""""""""""""vim-signature settings"""""""""""""""""""""""""" """"""""""""""""""""""""""""""vim-signature settings""""""""""""""""""""""""""
" change mark highlight to be more visible " change mark highlight to be more visible
augroup signature_highlight augroup signature_highlight
autocmd! autocmd!
@ -1381,7 +1331,7 @@ let g:neomake_error_sign={'text': '✗'}
" which linter to enable for Python source file linting " which linter to enable for Python source file linting
" let g:neomake_python_enabled_makers = ['flake8', 'pylint'] " let g:neomake_python_enabled_makers = ['flake8', 'pylint']
let g:neomake_python_enabled_makers = ['flake8'] let g:neomake_python_enabled_makers = ['flake8', 'pylint']
" whether to open quickfix or location list automatically " whether to open quickfix or location list automatically
let g:neomake_open_list = 0 let g:neomake_open_list = 0
@ -1405,7 +1355,6 @@ let g:neomake_open_list = 0
"{{ git-related "{{ git-related
"""""""""""""""""""""""""vim-signify settings"""""""""""""""""""""""""""""" """""""""""""""""""""""""vim-signify settings""""""""""""""""""""""""""""""
" the VCS to use " the VCS to use
let g:signify_vcs_list = [ 'git' ] let g:signify_vcs_list = [ 'git' ]
@ -1416,7 +1365,6 @@ let g:signify_sign_change = '~'
"}} "}}
"{{ Markdown writing "{{ Markdown writing
"""""""""""""""""""""""""goyo.vim settings"""""""""""""""""""""""""""""" """""""""""""""""""""""""goyo.vim settings""""""""""""""""""""""""""""""
" make goyo and limelight work together automatically " make goyo and limelight work together automatically
augroup goyo_work_with_limelight augroup goyo_work_with_limelight
autocmd! autocmd!
@ -1425,7 +1373,6 @@ augroup goyo_work_with_limelight
augroup END augroup END
"""""""""""""""""""""""""vim-pandoc-syntax settings""""""""""""""""""""""""" """""""""""""""""""""""""vim-pandoc-syntax settings"""""""""""""""""""""""""
" do not conceal urls (seems does not work) " do not conceal urls (seems does not work)
let g:pandoc#syntax#conceal#urls = 0 let g:pandoc#syntax#conceal#urls = 0
@ -1436,7 +1383,6 @@ augroup pandoc_syntax
augroup END augroup END
"""""""""""""""""""""""""plasticboy/vim-markdown settings""""""""""""""""""" """""""""""""""""""""""""plasticboy/vim-markdown settings"""""""""""""""""""
" disable header folding " disable header folding
let g:vim_markdown_folding_disabled = 1 let g:vim_markdown_folding_disabled = 1
@ -1456,7 +1402,6 @@ let g:vim_markdown_json_frontmatter = 1 " for JSON format
let g:vim_markdown_toc_autofit = 1 let g:vim_markdown_toc_autofit = 1
"""""""""""""""""""""""""markdown-preview settings""""""""""""""""""" """""""""""""""""""""""""markdown-preview settings"""""""""""""""""""
" only setting this for suitable platforms " only setting this for suitable platforms
if has('win32') || has('macunix') if has('win32') || has('macunix')
" do not close the preview tab when switching to other buffers " do not close the preview tab when switching to other buffers
@ -1468,7 +1413,6 @@ if has('win32') || has('macunix')
endif endif
""""""""""""""""""""""""vim-markdownfootnotes settings"""""""""""""""""""""""" """"""""""""""""""""""""vim-markdownfootnotes settings""""""""""""""""""""""""
" replace the default mappings provided by the plugin " replace the default mappings provided by the plugin
imap ^^ <Plug>AddVimFootnote imap ^^ <Plug>AddVimFootnote
nmap ^^ <Plug>AddVimFootnote nmap ^^ <Plug>AddVimFootnote
@ -1479,7 +1423,6 @@ nmap @@ <Plug>ReturnFromFootnote
"{{ LaTeX editting "{{ LaTeX editting
""""""""""""""""""""""""""""vimtex settings""""""""""""""""""""""""""""" """"""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
if ( has('macunix') || has('win32')) && executable('latex') if ( has('macunix') || has('win32')) && executable('latex')
" enhanced matching with matchup plugin " enhanced matching with matchup plugin
let g:matchup_override_vimtex = 1 let g:matchup_override_vimtex = 1
@ -1568,7 +1511,6 @@ endif
"{{ status line, look "{{ status line, look
"""""""""""""""""""""""""indentLine settings"""""""""""""""""""""""""" """""""""""""""""""""""""indentLine settings""""""""""""""""""""""""""
" whether to enable indentLine " whether to enable indentLine
let g:indentLine_enabled = 1 let g:indentLine_enabled = 1
@ -1590,12 +1532,11 @@ augroup indentline_disable_ft
augroup END augroup END
"""""""""""""""""""""""""""vim-airline setting"""""""""""""""""""""""""""""" """""""""""""""""""""""""""vim-airline setting""""""""""""""""""""""""""""""
" set a airline theme only if it exists, else we resort to default color " set a airline theme only if it exists, else we resort to default color
let s:candidate_airlinetheme = ['alduin', 'ayu_mirage', 'base16_flat', let s:candidate_airlinetheme = ['alduin', 'ayu_mirage', 'base16_flat',
\ 'monochrome', 'base16_grayscale', 'lucius', 'base16_tomorrow', \ 'monochrome', 'base16_grayscale', 'lucius', 'base16_tomorrow',
\ 'base16_adwaita', 'biogoo', 'distinguished', 'gruvbox', 'jellybeans', \ 'base16_adwaita', 'biogoo', 'distinguished', 'gruvbox', 'jellybeans',
\ 'luna', 'raven', 'seagull', 'solarized_flood', 'term', 'vice', 'zenburn'] \ 'luna', 'raven', 'seagull', 'term', 'vice', 'zenburn']
let s:idx = RandInt(0, len(s:candidate_airlinetheme)-1) let s:idx = RandInt(0, len(s:candidate_airlinetheme)-1)
let s:theme = s:candidate_airlinetheme[s:idx] let s:theme = s:candidate_airlinetheme[s:idx]
@ -1667,7 +1608,6 @@ let g:airline_symbols.maxlinenr = ''
"{{ misc plugin setting "{{ misc plugin setting
""""""""""""""""""" vim-highlightedyank settings """""""""""""" """"""""""""""""""" vim-highlightedyank settings """"""""""""""
" reverse the highlight color for yanked text for better visuals " reverse the highlight color for yanked text for better visuals
highlight HighlightedyankRegion cterm=reverse gui=reverse highlight HighlightedyankRegion cterm=reverse gui=reverse
@ -1675,7 +1615,6 @@ highlight HighlightedyankRegion cterm=reverse gui=reverse
let g:highlightedyank_highlight_duration = 1000 let g:highlightedyank_highlight_duration = 1000
""""""""""""""""""""""""""""vim-matchup settings""""""""""""""""""""""""""""" """"""""""""""""""""""""""""vim-matchup settings"""""""""""""""""""""""""""""
" whether to enable matching inside comment or string " whether to enable matching inside comment or string
let g:matchup_delim_noskips = 0 let g:matchup_delim_noskips = 0
@ -1692,13 +1631,11 @@ augroup matchup_matchword_highlight
augroup END augroup END
""""""""""""""""""""""""""quickrun settings""""""""""""""""""""""""""""" """"""""""""""""""""""""""quickrun settings"""""""""""""""""""""""""""""
let g:quickrun_no_default_key_mappings = 1 let g:quickrun_no_default_key_mappings = 1
nnoremap<silent> <F9> :QuickRun<CR> nnoremap<silent> <F9> :QuickRun<CR>
let g:quickrun_config = {'outputter/buffer/close_on_empty': 1} let g:quickrun_config = {'outputter/buffer/close_on_empty': 1}
""""""""""""""""""""""""comfortable-motion settings """""""""""""""""""""" """"""""""""""""""""""""comfortable-motion settings """"""""""""""""""""""
let g:comfortable_motion_scroll_down_key = 'j' let g:comfortable_motion_scroll_down_key = 'j'
let g:comfortable_motion_scroll_up_key = 'k' let g:comfortable_motion_scroll_up_key = 'k'
@ -1722,7 +1659,6 @@ set background=dark
"{{ colorscheme settings "{{ colorscheme settings
""""""""""""""""""""""""""""gruvbox settings""""""""""""""""""""""""""" """"""""""""""""""""""""""""gruvbox settings"""""""""""""""""""""""""""
" we should check if theme exists before using it, otherwise you will get " we should check if theme exists before using it, otherwise you will get
" error message when starting Nvim " error message when starting Nvim
if HasColorscheme('gruvbox') if HasColorscheme('gruvbox')
@ -1738,50 +1674,36 @@ else
colorscheme desert colorscheme desert
endif endif
""""""""""""""""""""""""""" deus settings""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""" deus settings"""""""""""""""""""""""""""""""""
" colorscheme deus " colorscheme deus
"""""""""""""""""""""""" challenger_deep settings"""""""""""""""""""""""" """"""""""""""""""""""""""" solarized8 settings"""""""""""""""""""""""""
" colorscheme challenger_deep
""""""""""""""""""""""""""" solarized8 settings"""""""""""""""""""""""""
" solarized colorscheme without bullshit " solarized colorscheme without bullshit
" let g:solarized_term_italics=1 " let g:solarized_term_italics=1
" let g:solarized_visibility="high" " let g:solarized_visibility="high"
" colorscheme solarized8_high " colorscheme solarized8_high
""""""""""""""""""""""""""" nord-vim settings""""""""""""""""""""""""" """"""""""""""""""""""""""" nord-vim settings"""""""""""""""""""""""""
" let g:nord_italic = 1 " let g:nord_italic = 1
" let g:nord_underline = 1 " let g:nord_underline = 1
" let g:nord_italic_comments = 1 " let g:nord_italic_comments = 1
" colorscheme nord " colorscheme nord
""""""""""""""""""""""""""" vim-one settings""""""""""""""""""""""""""""" """"""""""""""""""""""""""" vim-one settings"""""""""""""""""""""""""""""
" let g:one_allow_italics = 1 " let g:one_allow_italics = 1
" colorscheme one " colorscheme one
"""""""""""""""""""""""""""material.vim settings"""""""""""""""""""""""""" """""""""""""""""""""""""""material.vim settings""""""""""""""""""""""""""
" let g:material_terminal_italics = 1 " let g:material_terminal_italics = 1
" " theme_style can be 'default', 'dark' or 'palenight' " " theme_style can be 'default', 'dark' or 'palenight'
" let g:material_theme_style = 'dark' " let g:material_theme_style = 'dark'
" colorscheme material " colorscheme material
"}}
"{{ custom highlight group settings """""""""""""""""""""""""""material.vim settings""""""""""""""""""""""""""
" change the color of popup menu for autocompletion " let g:badwolf_darkgutter = 0
" extracted from spf13-vim, see https://goo.gl/frRXHP " " Make the tab line lighter than the background.
" highlight Pmenu guifg=#000000 guibg=#F8F8F8 ctermfg=black ctermbg=Lightgray " let g:badwolf_tabline = 2
" highlight PmenuSbar guifg=#8A95A7 guibg=#F8F8F8 gui=NONE ctermfg=darkcyan " colorscheme badwolf
" \ ctermbg=lightgray cterm=NONE
" highlight PmenuThumb guifg=#F8F8F8 guibg=#8A95A7 gui=NONE ctermfg=lightgray
" \ ctermbg=darkcyan cterm=NONE
"custom highlight for ColorColumn
" highlight ColorColumn ctermbg=235 guibg=#2c2d27
"}} "}}
"} "}
@ -1797,4 +1719,4 @@ endif
" - https://github.com/gkapfham/dotfiles/blob/master/.vimrc " - https://github.com/gkapfham/dotfiles/blob/master/.vimrc
" The ascii art on the frontpage is generated using http://tinyurl.com/y6szckgd " The ascii art on the frontpage is generated using http://tinyurl.com/y6szckgd
"} "}