|
|
@ -14,9 +14,12 @@ Plug 'joshdick/onedark.vim'
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'itchyny/lightline.vim'
|
|
|
|
Plug 'itchyny/lightline.vim'
|
|
|
|
Plug 'daviesjamie/vim-base16-lightline'
|
|
|
|
Plug 'daviesjamie/vim-base16-lightline'
|
|
|
|
Plug 'maximbaz/lightline-ale'
|
|
|
|
"Plug 'maximbaz/lightline-ale'
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'gioele/vim-autoswap' "Requires wmctrl
|
|
|
|
Plug 'gioele/vim-autoswap' "Requires wmctrl
|
|
|
|
|
|
|
|
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'scrooloose/nerdcommenter'
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'sheerun/vim-polyglot'
|
|
|
|
Plug 'sheerun/vim-polyglot'
|
|
|
|
Plug 'sirtaj/vim-openscad'
|
|
|
|
Plug 'sirtaj/vim-openscad'
|
|
|
@ -24,10 +27,12 @@ Plug 'othree/yajs.vim'
|
|
|
|
Plug 'othree/es.next.syntax.vim'
|
|
|
|
Plug 'othree/es.next.syntax.vim'
|
|
|
|
Plug 'othree/javascript-libraries-syntax.vim'
|
|
|
|
Plug 'othree/javascript-libraries-syntax.vim'
|
|
|
|
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
|
|
|
|
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
|
|
|
|
|
|
|
|
Plug 'hail2u/vim-css3-syntax'
|
|
|
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
|
|
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
|
|
|
Plug 'Vimjas/vim-python-pep8-indent'
|
|
|
|
Plug 'Vimjas/vim-python-pep8-indent'
|
|
|
|
Plug 'ntpeters/vim-better-whitespace'
|
|
|
|
Plug 'ntpeters/vim-better-whitespace'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'rhysd/clever-f.vim'
|
|
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
Plug 'scrooloose/nerdtree'
|
|
|
|
Plug 'scrooloose/nerdtree'
|
|
|
|
Plug 'xuyuanp/nerdtree-git-plugin'
|
|
|
|
Plug 'xuyuanp/nerdtree-git-plugin'
|
|
|
@ -40,7 +45,7 @@ Plug 'lervag/vimtex'
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'dense-analysis/ale'
|
|
|
|
" Plug 'dense-analysis/ale'
|
|
|
|
|
|
|
|
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
|
|
|
|
|
|
|
@ -76,6 +81,10 @@ let g:solarized_bold = 1
|
|
|
|
let g:solarized_underline = 1
|
|
|
|
let g:solarized_underline = 1
|
|
|
|
let g:solarized_italic = 1
|
|
|
|
let g:solarized_italic = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Fix for styled-components
|
|
|
|
|
|
|
|
autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart
|
|
|
|
|
|
|
|
autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear
|
|
|
|
|
|
|
|
|
|
|
|
set termguicolors
|
|
|
|
set termguicolors
|
|
|
|
colorscheme {{VIMCOLORSCHEME}}
|
|
|
|
colorscheme {{VIMCOLORSCHEME}}
|
|
|
|
set background={{VIMBACKGROUND}}
|
|
|
|
set background={{VIMBACKGROUND}}
|
|
|
@ -121,7 +130,14 @@ set scrolloff=10
|
|
|
|
set cmdheight=2
|
|
|
|
set cmdheight=2
|
|
|
|
set updatetime=300
|
|
|
|
set updatetime=300
|
|
|
|
set shortmess+=c
|
|
|
|
set shortmess+=c
|
|
|
|
set signcolumn=yes
|
|
|
|
|
|
|
|
|
|
|
|
if has("patch-8.1.1564")
|
|
|
|
|
|
|
|
" Recently vim can merge signcolumn and number column into one
|
|
|
|
|
|
|
|
set signcolumn=number
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
set signcolumn=yes
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
set lazyredraw " Redraw only when we need to.
|
|
|
|
set lazyredraw " Redraw only when we need to.
|
|
|
|
set showmatch " Highlight matching [{()}]
|
|
|
|
set showmatch " Highlight matching [{()}]
|
|
|
|
|
|
|
|
|
|
|
@ -146,11 +162,13 @@ set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo
|
|
|
|
set mouse=a
|
|
|
|
set mouse=a
|
|
|
|
|
|
|
|
|
|
|
|
" Backups
|
|
|
|
" Backups
|
|
|
|
set backup
|
|
|
|
set directory=$XDG_DATA_HOME/nvim/swap/
|
|
|
|
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
|
|
|
|
set backupdir=$XDG_DATA_HOME/nvim/backup/
|
|
|
|
set backupskip=/tmp/*,/private/tmp/*
|
|
|
|
set backupskip=/tmp/*
|
|
|
|
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
|
|
|
|
set undodir=$XDG_DATA_HOME/nvim/undodir/
|
|
|
|
set writebackup
|
|
|
|
set undofile
|
|
|
|
|
|
|
|
set nobackup
|
|
|
|
|
|
|
|
set nowritebackup
|
|
|
|
|
|
|
|
|
|
|
|
" ###########
|
|
|
|
" ###########
|
|
|
|
" # Keymaps #
|
|
|
|
" # Keymaps #
|
|
|
@ -175,6 +193,17 @@ nnoremap <leader>s :mksession<CR>
|
|
|
|
" NERD Tree
|
|
|
|
" NERD Tree
|
|
|
|
map <C-n> :NERDTreeToggle<CR>
|
|
|
|
map <C-n> :NERDTreeToggle<CR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Nerd commenter
|
|
|
|
|
|
|
|
vmap <C-_> <plug>NERDCommenterToggle
|
|
|
|
|
|
|
|
nmap <C-_> <plug>NERDCommenterToggle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let g:NERDSpaceDelims = 1
|
|
|
|
|
|
|
|
let g:NERDDefaultAlign = 'left'
|
|
|
|
|
|
|
|
let g:NERDCompactSexyComs = 1
|
|
|
|
|
|
|
|
let g:NERDCommentEmptyLines = 1
|
|
|
|
|
|
|
|
let g:NERDTrimTrailingWhitespace = 1
|
|
|
|
|
|
|
|
let g:NERDToggleCheckAllLines = 1
|
|
|
|
|
|
|
|
|
|
|
|
" Ale
|
|
|
|
" Ale
|
|
|
|
nmap <silent> <leader>aj :ALENext<cr>
|
|
|
|
nmap <silent> <leader>aj :ALENext<cr>
|
|
|
|
nmap <silent> <leader>ak :ALEPrevious<cr>
|
|
|
|
nmap <silent> <leader>ak :ALEPrevious<cr>
|
|
|
@ -207,16 +236,19 @@ let g:lightline = {
|
|
|
|
\ 'left': [ [ 'mode', 'paste' ],
|
|
|
|
\ 'left': [ [ 'mode', 'paste' ],
|
|
|
|
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ],
|
|
|
|
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ],
|
|
|
|
\ [ 'hunksummary' ] ],
|
|
|
|
\ [ 'hunksummary' ] ],
|
|
|
|
\ 'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ],
|
|
|
|
\ 'right': [ [ 'cocstatus' ],
|
|
|
|
\ [ 'percent', 'lineinfo'],
|
|
|
|
\ [ 'percent', 'lineinfo'],
|
|
|
|
\ [ 'fileformat', 'fileencoding', 'filetype'] ]
|
|
|
|
\ [ 'fileformat', 'fileencoding', 'filetype'] ]
|
|
|
|
\ },
|
|
|
|
\ },
|
|
|
|
\ 'component_function': {
|
|
|
|
\ 'component_function': {
|
|
|
|
|
|
|
|
\ 'cocstatus': 'coc#status',
|
|
|
|
\ 'gitbranch': 'FugitiveHead',
|
|
|
|
\ 'gitbranch': 'FugitiveHead',
|
|
|
|
\ 'hunksummary': 'GitStatus'
|
|
|
|
\ 'hunksummary': 'GitStatus'
|
|
|
|
\ },
|
|
|
|
\ },
|
|
|
|
\}
|
|
|
|
\}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"'right': [ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ],
|
|
|
|
|
|
|
|
|
|
|
|
function! GitStatus()
|
|
|
|
function! GitStatus()
|
|
|
|
let [a,m,r] = GitGutterGetHunkSummary()
|
|
|
|
let [a,m,r] = GitGutterGetHunkSummary()
|
|
|
|
return printf('+%d ~%d -%d', a, m, r)
|
|
|
|
return printf('+%d ~%d -%d', a, m, r)
|
|
|
@ -241,14 +273,16 @@ let g:ale_linters = {
|
|
|
|
\ 'javascriptreact': ['eslint'],
|
|
|
|
\ 'javascriptreact': ['eslint'],
|
|
|
|
\ 'javascript.jsx': ['eslint'],
|
|
|
|
\ 'javascript.jsx': ['eslint'],
|
|
|
|
\ 'vim': ['vint'],
|
|
|
|
\ 'vim': ['vint'],
|
|
|
|
\ 'python': ['flake8']
|
|
|
|
\ 'python': ['flake8'],
|
|
|
|
|
|
|
|
\ 'json': ['fixjson']
|
|
|
|
\}
|
|
|
|
\}
|
|
|
|
|
|
|
|
|
|
|
|
let b:ale_fixers = {
|
|
|
|
let g:ale_fixers = {
|
|
|
|
\ 'javascript': ['eslint'],
|
|
|
|
\ 'javascript': ['eslint'],
|
|
|
|
\ 'javascriptreact': ['eslint'],
|
|
|
|
\ 'javascriptreact': ['eslint'],
|
|
|
|
\ 'javascript.jsx': ['eslint'],
|
|
|
|
\ 'javascript.jsx': ['eslint'],
|
|
|
|
\ 'python': ['yapf']
|
|
|
|
\ 'python': ['yapf'],
|
|
|
|
|
|
|
|
\ 'json': ['fixjson']
|
|
|
|
\}
|
|
|
|
\}
|
|
|
|
|
|
|
|
|
|
|
|
let g:ale_pattern_options = {
|
|
|
|
let g:ale_pattern_options = {
|
|
|
@ -256,10 +290,10 @@ let g:ale_pattern_options = {
|
|
|
|
\ '\.min\.css$': {'ale_linters': [], 'ale_fixers': []},
|
|
|
|
\ '\.min\.css$': {'ale_linters': [], 'ale_fixers': []},
|
|
|
|
\}
|
|
|
|
\}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Coc
|
|
|
|
" Coc
|
|
|
|
let g:coc_global_extensions = [
|
|
|
|
let g:coc_global_extensions = [
|
|
|
|
\ 'coc-tsserver',
|
|
|
|
\ 'coc-tsserver',
|
|
|
|
|
|
|
|
\ 'coc-eslint',
|
|
|
|
\ 'coc-json',
|
|
|
|
\ 'coc-json',
|
|
|
|
\ 'coc-css',
|
|
|
|
\ 'coc-css',
|
|
|
|
\ 'coc-html',
|
|
|
|
\ 'coc-html',
|
|
|
@ -268,30 +302,54 @@ let g:coc_global_extensions = [
|
|
|
|
\ 'coc-yaml',
|
|
|
|
\ 'coc-yaml',
|
|
|
|
\ 'coc-highlight',
|
|
|
|
\ 'coc-highlight',
|
|
|
|
\ 'coc-syntax',
|
|
|
|
\ 'coc-syntax',
|
|
|
|
\ 'coc-python'
|
|
|
|
\ 'coc-python',
|
|
|
|
|
|
|
|
\ 'coc-actions',
|
|
|
|
|
|
|
|
\ 'coc-vimlsp',
|
|
|
|
|
|
|
|
\ 'coc-sh',
|
|
|
|
|
|
|
|
\ 'coc-svg'
|
|
|
|
\]
|
|
|
|
\]
|
|
|
|
|
|
|
|
|
|
|
|
" Use tab for trigger completion with characters ahead and navigate.
|
|
|
|
" Use tab for trigger completion with characters ahead and navigate.
|
|
|
|
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
|
|
|
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
\ coc#refresh()
|
|
|
|
\ coc#refresh()
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
|
|
|
|
|
|
|
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Use <C-l> for trigger snippet expand.
|
|
|
|
|
|
|
|
imap <C-l> <Plug>(coc-snippets-expand)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Use <C-j> for select text for visual placeholder of snippet.
|
|
|
|
|
|
|
|
vmap <C-j> <Plug>(coc-snippets-select)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
|
|
|
|
|
|
|
|
let g:coc_snippet_next = '<c-j>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
|
|
|
|
|
|
|
|
let g:coc_snippet_prev = '<c-k>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Use <C-j> for both expand and jump (make expand higher priority.)
|
|
|
|
|
|
|
|
imap <C-j> <Plug>(coc-snippets-expand-jump)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let g:coc_snippet_next = '<tab>'
|
|
|
|
|
|
|
|
|
|
|
|
" Use <c-space> to trigger completion.
|
|
|
|
" Use <c-space> to trigger completion.
|
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
|
|
|
|
|
|
|
|
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
|
|
|
|
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
|
|
|
" Coc only does snippet and additional edit on confirm.
|
|
|
|
" position. Coc only does snippet and additional edit on confirm.
|
|
|
|
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
|
|
|
|
" Or use `complete_info` if your vim support it, like:
|
|
|
|
if exists('*complete_info')
|
|
|
|
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
" Use `[g` and `]g` to navigate diagnostics
|
|
|
|
" Use `[g` and `]g` to navigate diagnostics
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
@ -365,11 +423,13 @@ set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
|
|
|
|
|
|
|
|
|
|
|
" Using CocList
|
|
|
|
" Using CocList
|
|
|
|
" Show all diagnostics
|
|
|
|
" Show all diagnostics
|
|
|
|
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
|
|
|
nnoremap <silent> <space>d :<C-u>CocList diagnostics<cr>
|
|
|
|
" Manage extensions
|
|
|
|
" Manage extensions
|
|
|
|
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
|
|
|
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
|
|
|
" Show commands
|
|
|
|
" Show commands
|
|
|
|
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
|
|
|
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
|
|
|
|
|
|
|
" Show actions
|
|
|
|
|
|
|
|
nnoremap <silent> <space>a :<C-u>CocList actions<cr>
|
|
|
|
" Find symbol of current document
|
|
|
|
" Find symbol of current document
|
|
|
|
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
|
|
|
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
|
|
|
" Search workspace symbols
|
|
|
|
" Search workspace symbols
|
|
|
@ -381,5 +441,17 @@ nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
|
|
|
" Resume latest coc list
|
|
|
|
" Resume latest coc list
|
|
|
|
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
|
|
|
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" coc-actions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Remap for do codeAction of selected region
|
|
|
|
|
|
|
|
function! s:cocActionsOpenFromSelected(type) abort
|
|
|
|
|
|
|
|
execute 'CocCommand actions.open ' . a:type
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
xmap <silent> <leader>a :<C-u>execute 'CocCommand actions.open ' . visualmode()<CR>
|
|
|
|
|
|
|
|
nmap <silent> <leader>a :<C-u>set operatorfunc=<SID>cocActionsOpenFromSelected<CR>g@
|
|
|
|
|
|
|
|
|
|
|
|
" vim-rainbow
|
|
|
|
" vim-rainbow
|
|
|
|
let g:rainbow_active = 1
|
|
|
|
let g:rainbow_active = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" vimtex
|
|
|
|
|
|
|
|
let g:tex_flavor = 'latex'
|
|
|
|