summary refs log tree commit diff
path: root/.vim/after/plugin
diff options
context:
space:
mode:
Diffstat (limited to '.vim/after/plugin')
-rw-r--r--.vim/after/plugin/clap.vim8
-rw-r--r--.vim/after/plugin/coc.vim84
-rw-r--r--.vim/after/plugin/line_bufferline.vim30
-rw-r--r--.vim/after/plugin/line_obsession.vim10
-rw-r--r--.vim/after/plugin/lsp.vim22
-rw-r--r--.vim/after/plugin/neomake.vim60
-rw-r--r--.vim/after/plugin/writing.vim108
7 files changed, 322 insertions, 0 deletions
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