diff options
| author | Robert Günzler <r@gnzler.io> | 2020-01-26 17:16:07 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2020-01-26 18:00:59 +0100 |
| commit | f5d56602df70950de6b7d40966b00c9939c81763 (patch) | |
| tree | b50ffeb5496fe3525cc1bab2629389ced95435b7 /.vim/after | |
Intial commit of v2
See https://drewdevault.com/2019/12/30/dotfiles.html
Diffstat (limited to '.vim/after')
| -rw-r--r-- | .vim/after/ftplugin/c.vim | 81 | ||||
| -rw-r--r-- | .vim/after/ftplugin/crontab.vim | 1 | ||||
| -rw-r--r-- | .vim/after/ftplugin/diff.vim | 33 | ||||
| -rw-r--r-- | .vim/after/ftplugin/gitrebase.vim | 8 | ||||
| -rw-r--r-- | .vim/after/ftplugin/go.vim | 77 | ||||
| -rw-r--r-- | .vim/after/ftplugin/gotmpl.vim | 1 | ||||
| -rw-r--r-- | .vim/after/ftplugin/i3.vim | 1 | ||||
| -rw-r--r-- | .vim/after/ftplugin/ledger.vim | 1 | ||||
| -rw-r--r-- | .vim/after/ftplugin/mail.vim | 22 | ||||
| -rw-r--r-- | .vim/after/ftplugin/make.vim | 2 | ||||
| -rw-r--r-- | .vim/after/ftplugin/markdown.vim | 27 | ||||
| -rw-r--r-- | .vim/after/ftplugin/python.vim | 3 | ||||
| -rw-r--r-- | .vim/after/ftplugin/rust.vim | 72 | ||||
| -rw-r--r-- | .vim/after/ftplugin/snippets.vim | 1 | ||||
| -rw-r--r-- | .vim/after/ftplugin/tex.vim | 0 | ||||
| -rw-r--r-- | .vim/after/ftplugin/toml.vim | 6 | ||||
| -rw-r--r-- | .vim/after/ftplugin/vim.vim | 1 | ||||
| -rw-r--r-- | .vim/after/plugin/clap.vim | 8 | ||||
| -rw-r--r-- | .vim/after/plugin/coc.vim | 84 | ||||
| -rw-r--r-- | .vim/after/plugin/line_bufferline.vim | 30 | ||||
| -rw-r--r-- | .vim/after/plugin/line_obsession.vim | 10 | ||||
| -rw-r--r-- | .vim/after/plugin/lsp.vim | 22 | ||||
| -rw-r--r-- | .vim/after/plugin/neomake.vim | 60 | ||||
| -rw-r--r-- | .vim/after/plugin/writing.vim | 108 |
24 files changed, 659 insertions, 0 deletions
diff --git a/.vim/after/ftplugin/c.vim b/.vim/after/ftplugin/c.vim new file mode 100644 index 0000000..85ff8a2 --- /dev/null +++ b/.vim/after/ftplugin/c.vim @@ -0,0 +1,81 @@ +setlocal cindent + +setlocal foldmethod=syntax +setlocal foldlevel=10 + +if exists('g:loaded_gutentags') + let g:gutentags_enabled = 1 +endif + +" toggle between header and implementation in c/cpp +function! Alternate_c() + let file = expand('%') + if match(file, '\.c') > 0 + exe ':e %<.h' + elseif match(file, '\.h') > 0 + exe ':e %<.c' + endif +endfunction + +nmap <Leader>a :call alternate#alternate() + +" source: https://github.com/igankevich/mesonic/blob/master/plugin/meson.vim +function! MesonProjectDir() + let l:dir = getcwd() " a starting directory to look for meson.build file + let l:project_dir = l:dir " the top-most directory with meson.build file + let l:nesting = 100 " maximal no. of subdirectories in a project + + " find top-most directory with readable meson.build file + while fnamemodify(l:dir, ':p') !=# '/' && l:nesting > 0 + if filereadable(l:dir . '/' . 'meson.build') + let l:project_dir = l:dir + endif + let l:dir = l:dir . '/..' + let l:nesting = l:nesting - 1 + endwhile + + " why one needs to do it two times? + let l:project_dir = fnamemodify(l:project_dir, ':p') + let l:project_dir = fnamemodify(l:project_dir, ':p') + return l:project_dir +endfunction + +if exists('g:loaded_neomake') + function! s:ninja_InitForJob(_jobinfo) dict + " set cwd to project dir + if !has_key(self, 'cwd') + let self.cwd = MesonProjectDir() + endif + " generate new error format lines + " source: https://github.com/igankevich/mesonic/blob/master/compiler/meson.vim#L67 + if !has_key(self, 'errorformat') + let g:meson_error_format = [ + \ '%EMeson encountered an error in file ' . l:project_subdir . '%f\, line %l\, column %c:,%Z%m', + \ '%Dninja: Entering directory `%f''', + \ '%f:%l.%c-%[%^:]%#: %t%[%^:]%#: %m' + \ ] + let self.errorformat = join(g:meson_error_format, ',') + endif + return self + endfunction + function! s:ninja_postprocess(entry) + if empty(a:entry.type) + let a:entry.type = 'E' + endif + endfunction + let g:neomake_c_ninja_maker = { + \ 'exe': 'ninja', + \ 'args': ['-C', 'build'], + \ 'append_file': 0, + \ 'postprocess': function('s:ninja_postprocess'), + \ 'InitForJob': function('s:ninja_InitForJob'), + \ } + let g:neomake_c_ninjaclean_maker = { + \ 'exe': 'ninja', + \ 'args': ['-C', 'build', 'clean'], + \ 'append_file': 0, + \ 'postprocess': function('s:ninja_postprocess'), + \ 'InitForJob': function('s:ninja_InitForJob'), + \ } + let g:neomake_c_enabled_makers = ['ninja'] +endif diff --git a/.vim/after/ftplugin/crontab.vim b/.vim/after/ftplugin/crontab.vim new file mode 100644 index 0000000..46faa33 --- /dev/null +++ b/.vim/after/ftplugin/crontab.vim @@ -0,0 +1 @@ +autocmd filetype crontab setlocal nobackup nowritebackup diff --git a/.vim/after/ftplugin/diff.vim b/.vim/after/ftplugin/diff.vim new file mode 100644 index 0000000..49974ec --- /dev/null +++ b/.vim/after/ftplugin/diff.vim @@ -0,0 +1,33 @@ +" disable annoying plugins +let b:coc_enabled = 0 +silent NeomakeDisable + +command! FindMergeMarker execute 'normal /^<<<<<<</<CR>' + +" shortcuts for 3-way merges +command! DiffGetLocal :diffget LOCAL +command! DiffGetRemote :diffget REMOTE +" quicksave +command! DiffSave :wqa + +cnoreabbrev fmm FindMergeMarker +cnoreabbrev dgl DiffGetLocal +cnoreabbrev dgr DiffGetRemote +cnoreabbrev ds DiffSave + + +let s:markers = { + \ 'ours': '^<<<<<<< ', + \ 'theirs': '^>>>>>>> ', + \ 'base': '^||||||| ', + \ 'delimiter': '^=======\r\?$', + \ } + +if &diff + " set custom ctags in diff mode + + let _ft=&filetype + let g:vista_ctags_cmd = { + \ _ft: 'ctags --format=2 --excmd=pattern --fields=nksSaf --file-scope=yes --sort=no --append=no --output-format=json --fields=-PF -f-', + \ } +endif diff --git a/.vim/after/ftplugin/gitrebase.vim b/.vim/after/ftplugin/gitrebase.vim new file mode 100644 index 0000000..e97d225 --- /dev/null +++ b/.vim/after/ftplugin/gitrebase.vim @@ -0,0 +1,8 @@ +set keywordprg=:GitShow +command! -nargs=1 -bar GitShow call s:git_show(<f-args>) + +function! s:git_show(commit) abort + let p = popup#new({ 'filetype': 'diff' }) + let p.contents = systemlist("git show ".a:commit) + call p.open() +endfunction diff --git a/.vim/after/ftplugin/go.vim b/.vim/after/ftplugin/go.vim new file mode 100644 index 0000000..b5c0d44 --- /dev/null +++ b/.vim/after/ftplugin/go.vim @@ -0,0 +1,77 @@ +setlocal noexpandtab +setlocal shiftwidth=8 +setlocal tabstop=8 + +let g:go_echo_go_info = 0 +let g:go_auto_type_info = 0 +" let g:go_info_mode = 'gocode' +" let g:go_auto_sameids = 1 +" let g:go_gocode_unimported_packages = 0 +" let g:go_list_type = 'quickfix' +let g:go_template_autocreate = 0 + +let g:go_mod_fmt_autosave = 1 +let g:go_fmt_autosave = 1 +let g:go_fmt_command = 'goimports' +let g:go_fmt_fail_silently = 1 +let g:go_fmt_experimental = 1 " solves https://github.com/fatih/vim-go/issues/502 + +" let g:go_term_enabled = 0 +" let g:go_term_mode = 'split' + +let g:go_metalinter_autosave = 0 +let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] +let g:go_metalinter_autosave_enabled = ['vet', 'golint'] +let g:go_metalinter_deadline = '2s' + +" let g:go_highlight_functions = 1 +" let g:go_highlight_methods = 1 +" let g:go_highlight_fields = 1 +" let g:go_highlight_structs = 1 +" let g:go_highlight_interfaces = 1 +" let g:go_highlight_build_constraints = 1 +" let g:go_highlight_types = 1 +" let g:go_highlight_extra_types = 1 +" let g:go_highlight_operators = 1 +" let g:go_highlight_space_tab_error = 1 +" let g:go_highlight_array_whitespace_error = 1 +" let g:go_highlight_trailing_whitespace_error = 1 + +function! Alternate_go() + call <Plug>(go-alternate-edit) +endfunction + +" augroup go +" au! +" au VimEnter go call vista#RunForNearestMethodOrFunction() +" augroup END + +if exists('g:loaded_neomake') + let g:neomake_go_build_maker = { + \ 'exe': 'go', + \ 'args': 'build', + \ 'append_file': 0, + \ } + " let g:neomake_go_golangci_lint_args = ['run', '--out-format=line-number', '--print-issued-lines=false'] + let g:neomake_go_enabled_makers = ['go', 'golangci_lint'] +endif + +" https://github.com/fatih/dotfiles/blob/master/vimrc#L380 +" create a go doc comment based on the word under the cursor +function! s:create_go_doc_comment() + norm "zyiw + execute ":put! z" + execute ":norm I// \<Esc>$" +endfunction +nnoremap <Leader>ui :<C-u>call <SID>create_go_doc_comment()<CR> + +" let b:deoplete_disable_auto_complete = 0 +" let g:neoformat_enabled_go = [] +" + +if exists('g:did_coc_loaded') + augroup CoC + au! + au BufWritePre * CocCommand editor.action.organizeImport + augroup END +endif diff --git a/.vim/after/ftplugin/gotmpl.vim b/.vim/after/ftplugin/gotmpl.vim new file mode 100644 index 0000000..cf481c4 --- /dev/null +++ b/.vim/after/ftplugin/gotmpl.vim @@ -0,0 +1 @@ +set commentstring=<!--\ %s\ --> diff --git a/.vim/after/ftplugin/i3.vim b/.vim/after/ftplugin/i3.vim new file mode 100644 index 0000000..9c2e80a --- /dev/null +++ b/.vim/after/ftplugin/i3.vim @@ -0,0 +1 @@ +set commentstring=#\ %s diff --git a/.vim/after/ftplugin/ledger.vim b/.vim/after/ftplugin/ledger.vim new file mode 100644 index 0000000..0aa29a3 --- /dev/null +++ b/.vim/after/ftplugin/ledger.vim @@ -0,0 +1 @@ +let g:ledger_bin = 'hledger' diff --git a/.vim/after/ftplugin/mail.vim b/.vim/after/ftplugin/mail.vim new file mode 100644 index 0000000..108cbf7 --- /dev/null +++ b/.vim/after/ftplugin/mail.vim @@ -0,0 +1,22 @@ +" backup aerc mails to a draft directory +let g:mail_draft_dir = $HOME.'/.aerc/drafts' + +function! SaveDraft() + if !isdirectory(g:mail_draft_dir) + call mkdir(g:mail_draft_dir, 'p') + endif + let draft = join([g:mail_draft_dir, expand('%:t')], '/') + execute 'silent! write! '.draft +endfunction + +function! RestoreFromDraft() + let draft = join([g:mail_draft_dir, expand('%:t')], '/') + echoerr 'todo' +endfunction + +augroup vim_mail + au! + au CursorHold * call SaveDraft() +augroup END + +set commentstring=>\ %s diff --git a/.vim/after/ftplugin/make.vim b/.vim/after/ftplugin/make.vim new file mode 100644 index 0000000..840c87a --- /dev/null +++ b/.vim/after/ftplugin/make.vim @@ -0,0 +1,2 @@ +" Disable tabs->spaces for Makefiles +autocmd filetype make setlocal noexpandtab diff --git a/.vim/after/ftplugin/markdown.vim b/.vim/after/ftplugin/markdown.vim new file mode 100644 index 0000000..0d42ff0 --- /dev/null +++ b/.vim/after/ftplugin/markdown.vim @@ -0,0 +1,27 @@ +setlocal foldlevel=1 + +if exists('g:loaded_lexima') + let g:lexima_enable_space_rules=0 +endif + +function! s:markdown_underline(bang) + call append(line('.'), substitute(getline('.'), '.', (a:bang ? '-' : '='), 'g')) +endfunction +command! -nargs=0 -bang Underline call s:markdown_underline(<bang>0) + +if exists('g:loaded_neomake') + let g:neomake_markdown_shiba_maker = { + \ 'exe': 'shiba', + \ 'args': ['--detach', '%:p'], + \ 'append_file': 0, + \ } + let g:neomake_markdown_enabled_makers = [] +endif + +augroup Markdown + au! + " au FileType markdown NeomakeDisableBuffer + + " Make vim-markdown-folding ignore frontmatter blocks + au BufNewFile,BufRead markdown syntax match Comment /\%^---\_.\{-}---$/ +augroup END diff --git a/.vim/after/ftplugin/python.vim b/.vim/after/ftplugin/python.vim new file mode 100644 index 0000000..667d22e --- /dev/null +++ b/.vim/after/ftplugin/python.vim @@ -0,0 +1,3 @@ +let g:neomake_python_enabled_makers = [] +let g:neoformat_enabled_python = ["yapf"] + diff --git a/.vim/after/ftplugin/rust.vim b/.vim/after/ftplugin/rust.vim new file mode 100644 index 0000000..9bf2ca9 --- /dev/null +++ b/.vim/after/ftplugin/rust.vim @@ -0,0 +1,72 @@ +set tags='./rusty-tags.vi/' + +if exists('g:loaded_lexima') + call lexima#add_rule({'filetype': ['rust'], 'char': "'", 'at': '<\%# | &\%#'}) +endif + +let g:racer_cmd = $HOME.'/.cargo/bin/racer' + +" let g:gutentags_enabled = 0 +" let g:gutentags_define_advanced_commands = 1 +" let g:gutentags_ctags_executable_rust = 'rusty-tags' +" let g:gutentags_ctags_extra_args = ['--omit-deps', 'vi'] +" let g:gutentags_ctags_tagfile = 'rusty-tags.vi' + +" when using standard ctags +let g:tagbar_type_rust = { + \ 'ctagstype' : 'rust', + \ 'kinds' : [ + \'T:types,type definitions', + \'f:functions,function definitions', + \'g:enum,enumeration names', + \'s:structure names', + \'m:modules,module names', + \'c:consts,static constants', + \'t:traits', + \'i:impls,trait implementations', + \] + \} + +" when using universal-ctags +" let g:rust_use_custom_ctags_defs = 1 " if using rust.vim +" let g:tagbar_type_rust = { +" \ 'ctagstype' : 'rust', +" \ 'kinds' : [ +" \ 'n:modules', +" \ 's:structures:1', +" \ 'i:interfaces', +" \ 'c:implementations', +" \ 'f:functions:1', +" \ 'g:enumerations:1', +" \ 't:type aliases:1:0', +" \ 'v:constants:1:0', +" \ 'M:macros:1', +" \ 'm:fields:1:0', +" \ 'e:enum variants:1:0', +" \ 'P:methods:1', +" \ ], +" \ 'sro': '::', +" \ 'kind2scope' : { +" \ 'n': 'module', +" \ 's': 'struct', +" \ 'i': 'interface', +" \ 'c': 'implementation', +" \ 'f': 'function', +" \ 'g': 'enum', +" \ 't': 'typedef', +" \ 'v': 'variable', +" \ 'M': 'macro', +" \ 'm': 'field', +" \ 'e': 'enumerator', +" \ 'P': 'method', +" \ }, +" \ } + +let g:neomake_rust_enabled_makers = ['cargo'] + +" augroup rust +" au! +" augroup END + +" nmap <Leader>d <Plug>(rust-doc) +" nmap <Leader>j <Plug>(rust-def) diff --git a/.vim/after/ftplugin/snippets.vim b/.vim/after/ftplugin/snippets.vim new file mode 100644 index 0000000..cb39fa6 --- /dev/null +++ b/.vim/after/ftplugin/snippets.vim @@ -0,0 +1 @@ +set list diff --git a/.vim/after/ftplugin/tex.vim b/.vim/after/ftplugin/tex.vim new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.vim/after/ftplugin/tex.vim diff --git a/.vim/after/ftplugin/toml.vim b/.vim/after/ftplugin/toml.vim new file mode 100644 index 0000000..03bf098 --- /dev/null +++ b/.vim/after/ftplugin/toml.vim @@ -0,0 +1,6 @@ +" let g:neoformat_toml_tomlfix = { +" \ 'exe': 'tomlfix', +" \ 'args': ['-w'], +" \ 'replace': 1, +" \ } +" let g:neoformat_enabled_toml = ['tomlfix'] diff --git a/.vim/after/ftplugin/vim.vim b/.vim/after/ftplugin/vim.vim new file mode 100644 index 0000000..a6014c7 --- /dev/null +++ b/.vim/after/ftplugin/vim.vim @@ -0,0 +1 @@ +set foldmethod=marker diff --git a/.vim/after/plugin/clap.vim b/.vim/after/plugin/clap.vim new file mode 100644 index 0000000..b5d48db --- /dev/null +++ b/.vim/after/plugin/clap.vim @@ -0,0 +1,8 @@ +if !exists('g:loaded_clap') + finish +endif + +let g:clap_selected_sign = { 'text': '* ', 'texthl': "WarningMsg", "linehl": "ClapSelected" } + +nnoremap <leader>cc :Clap<CR> +nmap <leader>cg :Clap grep<CR> diff --git a/.vim/after/plugin/coc.vim b/.vim/after/plugin/coc.vim new file mode 100644 index 0000000..2ebe27a --- /dev/null +++ b/.vim/after/plugin/coc.vim @@ -0,0 +1,84 @@ +" coc json config -> ../../coc-settings.json +if !exists('g:did_coc_loaded') + finish +endif + +set completeopt=noinsert,menuone,noselect +set completeopt-=preview +set shortmess+=c +" set showmatch + +" let g:coc_auto_copen = 1 +let g:coc_snippet_next = '<Tab>' +let g:coc_snippet_prev = '<S-Tab>' + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" inoremap <silent><expr> <Tab> +" \ pumvisible() ? "\<C-n>" : +" \ <SID>check_back_space() ? "\<Tab>" : +" \ coc#refresh() +inoremap <silent><expr> <Tab> + \ pumvisible() ? coc#_select_confirm() : + \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" : + \ <SID>check_back_space() ? "\<Tab>" : + \ coc#refresh() + +inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<C-h>" +inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" +inoremap <silent><expr> <C-Space> coc#refresh() + +vmap <Tab> <Plug>(coc-snippets-select) + +nmap <silent> [c <Plug>(coc-diagnostic-next) +nmap <silent> ]c <Plug>(coc-diagnostic-prev) +nmap <leader>lc :CocList diagnostics<CR> + +imap <silent> <C-p> <Plug>(coc-complete-custom) +nmap <leader>d <Plug>(coc-definition) +nmap <leader>t <Plug>(coc-type-definition) +nmap <leader>i <Plug>(coc-implementation) +nmap <leader>r <Plug>(coc-references) +nmap <leader>rn <Plug>(coc-rename) +nmap <leader>qf <Plug>(coc-fix-current) +nmap <leader>ac <Plug>(coc-codeaction) + +xmap <leader>f <Plug>(coc-format-selected) +nmap <leader>f <Plug>(coc-format-selected) + +xmap <leader>a <Plug>(coc-codeaction-current) +nmap <leader>a <Plug>(coc-codeaction-current) +nmap <leader>ac <Plug>(coc-codeaction) + +nmap <Leader>o :CocList outline<CR> + +function! s:show_doc() + if (index(['vim', 'help'], &filetype) >= 0) + execute 'h ' . expand('<cword>') + else + call CocAction('doHover') + endif +endfunction +nmap <Leader>i :silent! call <SID>show_doc()<CR> + +au CursorHold * silent call CocActionAsync('highlight') + +command! -nargs=0 Format :call CocAction('format') +command! -nargs=? Fold :call CocAction('fold', <f-args>) + +let g:lightline.component_function.coc = 'LightLineCocStatus' +function! LightLineCocStatus() + let info = get(b:, 'coc_diagnostic_info', {}) + if empty(info) | return '' | endif + let msgs = [] + if get(info, 'error', 0) + call add(msgs, '✘ ' . info['error']) + endif + if get(info, 'warning', 0) + call add(msgs, '‼ ' . info['warning']) + endif + return 'coc: ' . join(msgs, ' ') +endfunction diff --git a/.vim/after/plugin/line_bufferline.vim b/.vim/after/plugin/line_bufferline.vim new file mode 100644 index 0000000..551790f --- /dev/null +++ b/.vim/after/plugin/line_bufferline.vim @@ -0,0 +1,30 @@ +if !exists('g:loaded_bufferline') + finish +endif + +if !exists('g:lightline.tabline.left') + let g:lightline.tabline.left = [] +endif +let g:lightline.tabline.left += [['bufferline']] +let g:lightline.component_expand.bufferline = 'LightLineBufferline' +let g:lightline.component_type.bufferline = 'tabsel' + +function! LightLineBufferline() + call bufferline#refresh_status() + let l:buffers = [ + \ g:bufferline_status_info.before, + \ g:bufferline_status_info.current, + \ g:bufferline_status_info.after + \ ] + + function! s:fmt(key, val) + let limit = 25 + if strlen(a:val) > limit + return trim(a:val)[:limit] . '..' + endif + return trim(a:val) + endfunction + + call map(l:buffers, function('s:fmt')) + return l:buffers +endfunction diff --git a/.vim/after/plugin/line_obsession.vim b/.vim/after/plugin/line_obsession.vim new file mode 100644 index 0000000..c4f774f --- /dev/null +++ b/.vim/after/plugin/line_obsession.vim @@ -0,0 +1,10 @@ +if !exists('g:loaded_obsession') + finish +endif + +let g:lightline.component_function.obsession = 'LightLineSession' + +function! LightLineSession() + let l:indicator = ObsessionStatus('active', 'paused') + return l:indicator ? '[obs '.l:indicator.']' : '' +endfunction diff --git a/.vim/after/plugin/lsp.vim b/.vim/after/plugin/lsp.vim new file mode 100644 index 0000000..d31886a --- /dev/null +++ b/.vim/after/plugin/lsp.vim @@ -0,0 +1,22 @@ +" if !has('nvim-0.5.0') +" echoerr 'nvim_lsp only works with neovim>=0.5.0' +" finish +" endif +finish + +silent LspInstall bashls +silent LspInstall cssls + +" call nvim_lsp#setup("gopls", {}) +call nvim_lsp#setup("pyls", {}) +call nvim_lsp#setup("rust_analyzer", {}) +call nvim_lsp#setup("texlab", {}) + +autocmd Filetype bash,shell,css,go,python,rust,tex,latex setl omnifunc=lsp#omnifunc + +nnoremap <silent> gd :call lsp#text_document_definition()<CR> +nnoremap <silent> gdc :call lsp#text_document_declaration()<CR> +nnoremap <silent> gt :call lsp#text_document_type_definition()<CR> +nnoremap <silent> gi :call lsp#text_document_implementation()<CR> +nnoremap <silent> ;h :call lsp#text_document_hover()<CR> +nnoremap <silent> ;s :call lsp#text_document_signature_help()<CR> diff --git a/.vim/after/plugin/neomake.vim b/.vim/after/plugin/neomake.vim new file mode 100644 index 0000000..7024408 --- /dev/null +++ b/.vim/after/plugin/neomake.vim @@ -0,0 +1,60 @@ +if !exists('g:loaded_neomake') + finish +endif + +" Neomake +cnoreabbrev neom Neomake +cnoreabbrev nm Neomake +call neomake#configure#automake('w') + +" \ 'BufWritePost': {'delay': 0}, +let g:neomake_error_sign = {'text': '✘', 'texthl': 'NeomakeErrorSign'} +let g:neomake_warning_sign = {'text': '‼', 'texthl': 'NeomakeWarningSign'} +let g:neomake_message_sign = {'text': '☛', 'texthl': 'NeomakeMessageSign'} +let g:neomake_info_sign = {'text': 'i', 'texthl': 'NeomakeInfoSign'} +" let g:neomake_error_sign = {'text': '✘', 'texthl': 'ALEErrorSign'} +" let g:neomake_warning_sign = {'text': '‼', 'texthl': 'ALEWarningSign'} +" let g:neomake_message_sign = {'text': '☛', 'texthl': 'ALEInfoSign'} +" let g:neomake_info_sign = {'text': 'i', 'texthl': 'ALEInfoSign'} +" let g:neomake_serialize = 1 + +let g:neomake_highlight_columns = 1 +let g:neomake_highlight_lines = 1 +let g:neomake_open_list = 0 + +" function! OnNeomakeJobFinished() +" let l:ctx = g:neomake_hook_context +" if l:ctx.jobinfo.exit_code != 0 +" echoerr l:ctx.jobinfo.maker.name . ' failed' +" endif +" endfunction +augroup neomake_hooks + au! + " au User NeomakeJobFinished call OnNeomakeJobFinished() + au BufWritePost * Neomake +augroup END + +" generic makers +let g:neomake_makeclean_maker = { 'exe': 'make', 'args': ['clean'], 'errorformat': '%f:%l:%c: %m' } +let g:neomake_make_maker = { 'exe': 'make', 'errorformat': '%f:%l:%c: %m' } + +nmap <leader>nm :Neomake<space> + +let g:lightline.component_function.neomake = 'LightLineNeomake' +function! LightLineNeomake() + let l:msg = neomake#statusline#get(bufnr('%'), { + \ 'format_status_disabled': '{{disabled_info}} %s', + \ 'format_status_enabled': '%s', + \ 'format_running': '… {{running_job_names}}', + \ 'format_loclist_ok': ' ✔', + \ 'format_loclist_issues': '%s', + \ 'format_loclist_unknown': '', + \ 'format_loclist_type_E': ' ✘ {{count}}', + \ 'format_loclist_type_W': ' ‼ {{count}}', + \ 'format_loclist_type_I': ' i {{count}}', + \ 'format_quickfix_type_E': '✘ {{count}}', + \ 'format_quickfix_type_W': '‼ {{count}}', + \ 'format_quickfix_type_I': 'i {{count}}', + \ }) + return l:msg ? 'nm:'.l:msg : '' +endfunction diff --git a/.vim/after/plugin/writing.vim b/.vim/after/plugin/writing.vim new file mode 100644 index 0000000..d868304 --- /dev/null +++ b/.vim/after/plugin/writing.vim @@ -0,0 +1,108 @@ +" Configuration for writing text in vim + +" Grammer checker +let g:grammarous#languagetool_cmd = 'languagetool' + +" Minimal UX for concentration +let g:goyo_width = 120 +let g:goyo_height = 90 +let g:goyo_linenr = 0 +nmap <F0> :Goyo<CR> + +let g:limelight_default_coefficient = 0.5 +let g:limelight_paragraph_span = 1 +" let g:limelight_default_coefficient = 0.5 +" let g:limelight_paragraph_span = 1 +let g:limelight_priority = -1 + +" goyo enter/leave funcs {{{ +function! s:goyo_enter() + if has('gui_running') || has('gui_vimr') + " set linespace = 7 + + elseif exists('$TMUX') + silent !tmux set status off + endif + + " set noshowmode + " set noshowcmd + set scrolloff=999 + Limelight + + " make sure :q in the last buffer, in Goyo also quits vim + let b:quitting = 0 + let b:quitting_bang = 0 + autocmd QuitPre <buffer> let b:quitting = 1 + cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q! +endfunction + +function! s:goyo_leave() + if has('gui_running') || has('gui_vimr') + " set linespace = 0 + + elseif exists('$TMUX') + silent !tmux set status on + endif + + " set showmode + " set showcmd + set scrolloff=5 + Limelight! + + " make sure :q in the last buffer, in Goyo also quits vim + if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 + if b:quitting_bang + qa! + else + qa + endif + endif +endfunction +" }}} + +" writing autocommands +function! s:writing_mode_enter() + set textwidth=120 + " ALEToggle + " Grammarous keymaps + nmap <Leader>c :GrammarousCheck --lang=de + nmap <Leader>gi <Plug>(grammarous-move-to-info-window) + nmap <Leader>gr <Plug>(grammarous-remove-error) + nmap <Leader>gd <Plug>(grammarous-disable-rule) + nmap <Leader>gf <Plug>(grammarous-fixit) + nmap <Leader>gn <Plug>(grammarous-move-to-next-error) + nmap <Leader>gp <Plug>(grammarous-move-to-previous-error) +endfunction + +augroup Writing + au! + au FileType markdown,tex call <SID>writing_mode_enter() + " goyo autocommands + au User GoyoEnter nested call <SID>goyo_enter() + au User GoyoLeave nested call <SID>goyo_leave() +augroup END + +" LaTeX +" let g:vimtex_view_general_viewer +" \ = '/Applications/Skim.app/Contents/SharedSupport/displayline' +" let g:vimtex_view_general_options = '-r @line @pdf @tex' + +" " This adds a callback hook that updates Skim after compilation +" let g:vimtex_latexmk_callback_hooks = ['UpdateSkim'] +" function! UpdateSkim(status) +" if !a:status | return | endif + +" let l:out = b:vimtex.out() +" let l:tex = expand('%:p') +" let l:cmd = [g:vimtex_view_general_viewer, '-r'] +" if !empty(system('pgrep Skim')) +" call extend(l:cmd, ['-g']) +" endif +" if has('nvim') +" call jobstart(l:cmd + [line('.'), l:out, l:tex]) +" elseif has('job') +" call job_start(l:cmd + [line('.'), l:out, l:tex]) +" else +" call system(join(l:cmd + [line('.'), shellescape(l:out), shellescape(l:tex)], ' ')) +" endif +" endfunction |