aboutsummaryrefslogtreecommitdiff
path: root/.vim/plugin
diff options
context:
space:
mode:
authorgxlin <[email protected]>2021-07-15 21:28:06 +0800
committergxlin <[email protected]>2021-07-15 21:28:06 +0800
commitd4e1469e4b0c5aaf5c23be555e8b224f9254d781 (patch)
treee68a0e5dd44ee43efc2d70c081f41ae3237a78c1 /.vim/plugin
parent36f249e1a7250e24f0c415b5bc53ba1b2f5806d4 (diff)
downloaddotfiles-d4e1469e4b0c5aaf5c23be555e8b224f9254d781.tar.gz
dotfiles-d4e1469e4b0c5aaf5c23be555e8b224f9254d781.tar.bz2
dotfiles-d4e1469e4b0c5aaf5c23be555e8b224f9254d781.zip
A usable boostrap config
Diffstat (limited to '.vim/plugin')
-rw-r--r--.vim/plugin/airline.plug4
-rw-r--r--.vim/plugin/ale.vim24
-rw-r--r--.vim/plugin/asyncrun.plug5
-rw-r--r--.vim/plugin/easymotion.plug3
-rw-r--r--.vim/plugin/fugitive.plug7
-rw-r--r--.vim/plugin/general.plug10
-rw-r--r--.vim/plugin/godot.vim35
-rw-r--r--.vim/plugin/gutentags.plug8
-rw-r--r--.vim/plugin/init.vim28
-rw-r--r--.vim/plugin/lang.plug2
-rw-r--r--.vim/plugin/leaderf.vim21
-rw-r--r--.vim/plugin/ledger.plug14
-rw-r--r--.vim/plugin/lsp.plug39
-rw-r--r--.vim/plugin/markdown.plug4
-rw-r--r--.vim/plugin/misc.plug14
-rw-r--r--.vim/plugin/slime.plug15
-rw-r--r--.vim/plugin/tex.plug1
-rw-r--r--.vim/plugin/vimspector.plug68
-rw-r--r--.vim/plugin/vimwiki.plug9
-rw-r--r--.vim/plugin/vista.plug9
-rw-r--r--.vim/plugin/youcompleteme.vim13
21 files changed, 333 insertions, 0 deletions
diff --git a/.vim/plugin/airline.plug b/.vim/plugin/airline.plug
new file mode 100644
index 0000000..a1c1b94
--- /dev/null
+++ b/.vim/plugin/airline.plug
@@ -0,0 +1,4 @@
+Plug 'vim-airline/vim-airline'
+Plug 'vim-airline/vim-airline-themes'
+
+let g:airline#extensions#tabline#enabled = 1
diff --git a/.vim/plugin/ale.vim b/.vim/plugin/ale.vim
new file mode 100644
index 0000000..105bfa8
--- /dev/null
+++ b/.vim/plugin/ale.vim
@@ -0,0 +1,24 @@
+let g:ale_linters_explicit = 1
+let g:ale_completion_enabled = 1
+let g:ale_completion_autoimport = 1
+let g:ale_completion_delay = 500
+let g:ale_echo_delay = 20
+let g:ale_lint_delay = 500
+let g:ale_echo_msg_format = '[%linter%] %code: %%s'
+let g:ale_lint_on_text_changed = 'normal'
+let g:ale_lint_on_insert_leave = 1
+let g:airline#extensions#ale#enabled = 1
+
+let g:ale_c_gcc_options = '-Wall -O2 -std=c99'
+let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++14'
+let g:ale_c_cppcheck_options = ''
+let g:ale_cpp_cppcheck_options = ''
+
+let g:ale_sign_error = "\ue009\ue009"
+hi! clear SpellBad
+hi! clear SpellCap
+hi! clear SpellRare
+hi! SpellBad gui=undercurl guisp=red
+hi! SpellCap gui=undercurl guisp=blue
+hi! SpellRare gui=undercurl guisp=magenta
+
diff --git a/.vim/plugin/asyncrun.plug b/.vim/plugin/asyncrun.plug
new file mode 100644
index 0000000..bed9473
--- /dev/null
+++ b/.vim/plugin/asyncrun.plug
@@ -0,0 +1,5 @@
+let g:asyncrun_open = 6 " the number of lines of quickfix window
+let g:asyncrun_bell = 1 " the bell rings when the task is done
+" use f10 to open/close asyncrun quickfix window
+nnoremap <F10> :call asyncrun#quickfix_toggle(6)<cr>
+
diff --git a/.vim/plugin/easymotion.plug b/.vim/plugin/easymotion.plug
new file mode 100644
index 0000000..ce87f12
--- /dev/null
+++ b/.vim/plugin/easymotion.plug
@@ -0,0 +1,3 @@
+Plug 'easymotion/vim-easymotion'
+
+map <Space> <Plug>(easymotion-prefix)
diff --git a/.vim/plugin/fugitive.plug b/.vim/plugin/fugitive.plug
new file mode 100644
index 0000000..8dd25b2
--- /dev/null
+++ b/.vim/plugin/fugitive.plug
@@ -0,0 +1,7 @@
+" vim: ft=vim
+
+Plug 'tpope/vim-fugitive'
+
+nnoremap <silent> <leader>gl :Gclog! -- %<CR>
+nnoremap <silent> <leader>gd :Gdiffsplit <CR>
+nnoremap <silent> <leader>gs :G<CR>
diff --git a/.vim/plugin/general.plug b/.vim/plugin/general.plug
new file mode 100644
index 0000000..4bbc709
--- /dev/null
+++ b/.vim/plugin/general.plug
@@ -0,0 +1,10 @@
+Plug 'Yggdroot/LeaderF', {'do': ':LeaderfInstallCExtension'}
+Plug 'Valloric/YouCompleteMe', {
+ \ 'do': 'python3 ./install.py --clangd-completer',
+ \ 'for': ['python', 'cpp', 'go', 'gdscript']
+ \ }
+Plug 'dense-analysis/ale'
+Plug 'sheerun/vim-polyglot'
+
+let g:ycm_language_server = []
+let g:Lf_RootMarkers = []
diff --git a/.vim/plugin/godot.vim b/.vim/plugin/godot.vim
new file mode 100644
index 0000000..49354f8
--- /dev/null
+++ b/.vim/plugin/godot.vim
@@ -0,0 +1,35 @@
+if has('macunix')
+ let g:godot_executable = '/Applications/Godot.app'
+endif
+if has('win32') || has('win32unix')
+ let g:godot_executable = ''
+endif
+
+let g:ycm_language_server += [
+ \ {
+ \ 'name': 'godot',
+ \ 'filetypes': ['gdscript'],
+ \ 'project_root_files': ['project.godot'],
+ \ 'port': 6008
+ \ }
+ \ ]
+
+let g:Lf_RootMarkers += ['project.godot']
+
+func! s:godot_settings() abort
+ setlocal tabstop=4
+ nnoremap <buffer> <leader>rl :GodotRunLast<CR>
+ nnoremap <buffer> <leader>rc :GodotRunCurrent<CR>
+ nnoremap <buffer> <leader>rr :GodotRun<CR>
+endfunc
+
+augroup godot | au!
+ au FileType gdscript call s:godot_settings()
+augroup end
+
+call ale#linter#Define('gdscript', {
+\ 'name': 'godot',
+\ 'lsp': 'socket',
+\ 'address': '127.0.0.1:6008',
+\ 'project_root': 'project.godot',
+\ })
diff --git a/.vim/plugin/gutentags.plug b/.vim/plugin/gutentags.plug
new file mode 100644
index 0000000..c2a7090
--- /dev/null
+++ b/.vim/plugin/gutentags.plug
@@ -0,0 +1,8 @@
+Plug 'ludovicchabant/vim-gutentags'
+
+let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project']
+let g:gutentags_ctags_tagfile = '.tags'
+let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
+let g:gutentags_ctags_extra_args = ['--c++-kinds=+px']
+let g:gutentags_ctags_extra_args = ['--c-kinds=+px']
+
diff --git a/.vim/plugin/init.vim b/.vim/plugin/init.vim
new file mode 100644
index 0000000..7f71d9c
--- /dev/null
+++ b/.vim/plugin/init.vim
@@ -0,0 +1,28 @@
+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
+
+let s:plugins = split(expand('~/.vim/plugin/*.plug'))
+let s:settings = split(expand('~/.vim/plugin/*.vim'))
+
+function! s:load_plugins()
+ for plugin in s:plugins
+ exec "source " . plugin
+ endfor
+endfunction
+
+function! s:load_settings()
+ for setting in s:settings
+ if setting !~ 'init.vim'
+ exec "source " . setting
+ endif
+ endfor
+endfunction
+
+call plug#begin('~/.vim/plugged')
+call s:load_plugins()
+call plug#end()
+
+call s:load_settings()
diff --git a/.vim/plugin/lang.plug b/.vim/plugin/lang.plug
new file mode 100644
index 0000000..338de43
--- /dev/null
+++ b/.vim/plugin/lang.plug
@@ -0,0 +1,2 @@
+Plug 'habamax/vim-godot', {'for': 'gdscript'}
+
diff --git a/.vim/plugin/leaderf.vim b/.vim/plugin/leaderf.vim
new file mode 100644
index 0000000..043fe1b
--- /dev/null
+++ b/.vim/plugin/leaderf.vim
@@ -0,0 +1,21 @@
+" " Show icons, icons are shown by default
+let g:Lf_ShowDevIcons = 1
+
+let g:Lf_WindowPosition = 'popup'
+let g:Lf_ShortcutF = "<leader>ff"
+
+noremap <leader>fb :<C-U><C-R>=printf("Leaderf buffer %s", "")<CR><CR>
+noremap <leader>fm :<C-U><C-R>=printf("Leaderf mru %s", "")<CR><CR>
+noremap <leader>ft :<C-U><C-R>=printf("Leaderf bufTag %s", "")<CR><CR>
+noremap <leader>fl :<C-U><C-R>=printf("Leaderf line %s", "")<CR><CR>
+noremap <leader>fr :<C-U><C-R>=printf("Leaderf rg %s", "")<CR><CR>
+noremap <C-B> :<C-U><C-R>=printf("Leaderf! rg --current-buffer -e %s ", expand("<cword>"))<CR>
+noremap <C-F> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR>
+
+" search visually selected text literally
+xnoremap gf :<C-U><C-R>=printf("Leaderf! rg -F -e %s ", leaderf#Rg#visual())<CR>
+noremap go :<C-U>Leaderf! rg --recall<CR>
+
+let g:Lf_WorkingDirectoryMode = 'AF'
+
+let g:Lf_RootMarkers += ['.project', '.root', '.svn', '.git', '.hg', '.projectile']
diff --git a/.vim/plugin/ledger.plug b/.vim/plugin/ledger.plug
new file mode 100644
index 0000000..b3a1e25
--- /dev/null
+++ b/.vim/plugin/ledger.plug
@@ -0,0 +1,14 @@
+Plug 'ledger/vim-ledger', {'for': 'ledger'}
+
+let g:ledger_bin = 'ledger'
+let g:ledger_align_at = 50
+let g:ledger_commodity_before = 0
+
+au FileType ledger call s:ledger_keymap()
+
+function! s:ledger_keymap() abort
+ noremap { ?^\d<CR>
+ noremap } /^\d<CR>
+ inoremap <silent> <Tab> <C-r>=ledger#autocomplete_and_align()<CR>
+ vnoremap <silent> <Tab> :LedgerAlign<CR>
+endfunction
diff --git a/.vim/plugin/lsp.plug b/.vim/plugin/lsp.plug
new file mode 100644
index 0000000..1a5704b
--- /dev/null
+++ b/.vim/plugin/lsp.plug
@@ -0,0 +1,39 @@
+Plug 'prabirshrestha/vim-lsp'
+
+if executable('gopls')
+ au User lsp_setup call lsp#register_server({
+ \ 'name': 'gopls',
+ \ 'cmd': {server_info->['gopls']},
+ \ 'allowlist': ['go'],
+ \ })
+endif
+
+function! s:on_lsp_buffer_enabled() abort
+ setlocal omnifunc=lsp#complete
+ setlocal signcolumn=no
+ if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
+ nmap <buffer> gd <plug>(lsp-definition)
+ nmap <buffer> gs <plug>(lsp-document-symbol-search)
+ nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
+ nmap <buffer> gr <plug>(lsp-references)
+ nmap <buffer> gi <plug>(lsp-implementation)
+ nmap <buffer> gt <plug>(lsp-type-definition)
+ nmap <buffer> <leader>rn <plug>(lsp-rename)
+ nmap <buffer> [g <plug>(lsp-previous-diagnostic)
+ nmap <buffer> ]g <plug>(lsp-next-diagnostic)
+ nmap <buffer> K <plug>(lsp-hover)
+ inoremap <buffer> <expr><c-f> lsp#scroll(+4)
+ inoremap <buffer> <expr><c-d> lsp#scroll(-4)
+
+ let g:lsp_format_sync_timeout = 1000
+ autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
+
+ " refer to doc to add more commands
+endfunction
+
+augroup lsp_install
+ au!
+ " call s:on_lsp_buffer_enabled only for languages that has the server registered.
+ autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
+augroup END
+
diff --git a/.vim/plugin/markdown.plug b/.vim/plugin/markdown.plug
new file mode 100644
index 0000000..1e12dad
--- /dev/null
+++ b/.vim/plugin/markdown.plug
@@ -0,0 +1,4 @@
+Plug 'iamcco/markdown-preview.nvim', {
+ \ 'do': {-> mkdp#util#install()},
+ \ 'for': ['markdown', 'vim-plug']
+ \ }
diff --git a/.vim/plugin/misc.plug b/.vim/plugin/misc.plug
new file mode 100644
index 0000000..a634210
--- /dev/null
+++ b/.vim/plugin/misc.plug
@@ -0,0 +1,14 @@
+Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'}
+
+Plug 'skywind3000/asyncrun.vim'
+
+let g:asyncrun_open = 6 " the number of lines of quickfix window
+let g:asyncrun_bell = 1 " the bell rings when the task is done
+" use f10 to open/close asyncrun quickfix window
+nnoremap <F10> :call asyncrun#quickfix_toggle(6)<cr>
+
+Plug 'mhinz/vim-signify'
+Plug 'tpope/vim-unimpaired'
+Plug 'godlygeek/tabular'
+
+Plug 'joshdick/onedark.vim'
diff --git a/.vim/plugin/slime.plug b/.vim/plugin/slime.plug
new file mode 100644
index 0000000..0989a66
--- /dev/null
+++ b/.vim/plugin/slime.plug
@@ -0,0 +1,15 @@
+Plug 'jpalardy/vim-slime', {
+ \'on': [
+ \'<Plug>SlimeRegionSend',
+ \'<Plug>SlimeParagraphSend',
+ \'<Plug>SlimeConfig'
+ \]
+ \}
+
+let g:slime_no_mappings = 1
+
+xmap <c-c><c-c> <Plug>SlimeRegionSend
+nmap <c-c><c-c> <Plug>SlimeParagraphSend
+nmap <c-c>v <Plug>SlimeConfig
+
+let g:slime_target = 'tmux'
diff --git a/.vim/plugin/tex.plug b/.vim/plugin/tex.plug
new file mode 100644
index 0000000..6c3f788
--- /dev/null
+++ b/.vim/plugin/tex.plug
@@ -0,0 +1 @@
+" Plug 'lervag/vimtex'
diff --git a/.vim/plugin/vimspector.plug b/.vim/plugin/vimspector.plug
new file mode 100644
index 0000000..a39d4bd
--- /dev/null
+++ b/.vim/plugin/vimspector.plug
@@ -0,0 +1,68 @@
+Plug 'puremourning/vimspector', { 'on': '<Plug>VimspectorContinue' }
+
+let g:vimspector_install_gadgets = ['debugpy']
+
+nmap <silent> <Leader>dc <Plug>VimspectorContinue
+nmap <silent> <Leader>dq <Plug>VimspectorStop
+nmap <silent> <Leader>db <Plug>VimspectorToggleBreakpoint
+nmap <silent> <Leader>dn <Plug>VimspectorStepOver
+nmap <silent> <Leader>ds <Plug>VimspectorStepInto
+nmap <silent> <Leader>df <Plug>VimspectorStepOut
+nmap <silent> <Leader>di <Plug>VimspectorBalloonEval
+xmap <silent> <Leader>di <Plug>VimspectorBalloonEval
+
+let s:mapped = {}
+
+function! s:set_debug_keymaps() abort
+ if has_key(s:mapped, string(bufnr()))
+ return
+ endif
+
+ " nmap <silent> <buffer> c <Plug>VimspectorContinue
+ " nmap <silent> <buffer> q <Plug>VimspectorStop
+ " nmap <silent> <buffer> b <Plug>VimspectorToggleBreakpoint
+ nmap <silent> <buffer> m <Plug>VimspectorStepOver
+ " nmap <silent> <buffer> s <Plug>VimspectorStepInto
+ " nmap <silent> <buffer> f <Plug>VimspectorStepOut
+ " nmap <silent> <buffer> i <Plug>VimspectorBalloonEval
+ " xmap <silent> <buffer> i <Plug>VimspectorBalloonEval
+
+ let s:mapped[string(bufnr())] = {'modifiable': &modifiable}
+
+ setlocal nomodifiable
+endfunction
+
+function! s:unset_debug_keymaps() abort
+ let original_buf = bufnr()
+ let hidden = &hidden
+
+ try
+ set hidden
+ for bufnr in keys(s:mapped)
+ try
+ execute 'noautocmd buffer' bufnr
+ " silent! nunmap <buffer> c
+ " silent! nunmap <buffer> q
+ " silent! nunmap <buffer> b
+ silent! nunmap <buffer> m
+ " silent! nunmap <buffer> s
+ " silent! nunmap <buffer> f
+ " silent! nunmap <buffer> i
+ " silent! xunmap <buffer> i
+
+ let &l:modifiable = s:mapped[bufnr]['modifiable']
+ endtry
+ endfor
+ finally
+ execute 'noautocmd buffer' original_buf
+ let &hidden = hidden
+ endtry
+
+ let s:mapped = {}
+endfunction
+
+augroup CustomMappings
+ au!
+ autocmd User VimspectorJumpedToFrame call s:set_debug_keymaps()
+ autocmd User VimspectorDebugEnded call s:unset_debug_keymaps()
+augroup end
diff --git a/.vim/plugin/vimwiki.plug b/.vim/plugin/vimwiki.plug
new file mode 100644
index 0000000..cba8593
--- /dev/null
+++ b/.vim/plugin/vimwiki.plug
@@ -0,0 +1,9 @@
+Plug 'vimwiki/vimwiki'
+
+let g:vimwiki_list = [{'path': '~/Documents/notes',
+ \ 'syntax': 'markdown', 'ext': '.md'}]
+
+au FileType vimwiki setlocal textwidth=72
+
+let g:vimwiki_CJK_length = 1
+let g:vimwiki_url_maxsave = 0
diff --git a/.vim/plugin/vista.plug b/.vim/plugin/vista.plug
new file mode 100644
index 0000000..02264b9
--- /dev/null
+++ b/.vim/plugin/vista.plug
@@ -0,0 +1,9 @@
+Plug 'liuchengxu/vista.vim'
+
+let g:vista_default_executive = 'ctags'
+
+let g:vista_executive_for = {
+ \ 'go': 'vim_lsp',
+ \ }
+
+nnoremap <leader>s :Vista<CR>
diff --git a/.vim/plugin/youcompleteme.vim b/.vim/plugin/youcompleteme.vim
new file mode 100644
index 0000000..4c9f570
--- /dev/null
+++ b/.vim/plugin/youcompleteme.vim
@@ -0,0 +1,13 @@
+let g:ycm_server_log_level = 'info'
+let g:ycm_add_preview_to_completeopt = 0
+let g:ycm_show_diagnostics_ui = 0
+let g:ycm_collect_identifiers_from_comments_and_strings = 1
+let g:ycm_complete_in_strings = 1
+
+let g:ycm_filetype_whilelist = {
+ \ "c": 1, "cpp": 1, "sh": 1, "zsh": 1,
+ \ "python": 1, "go": 1, "gdscript": 1
+ \ }
+let g:ycm_filetype_blacklist = {
+ \ 'ledger': 1
+ \ }