From 5bb5f13403dba9900f8c52858180f7cd9daf8cf1 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Wed, 23 Mar 2022 16:21:16 +0300 Subject: [PATCH] vim: coc settings --- etc/soft/nvim/vimrc | 84 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 22 deletions(-) diff --git a/etc/soft/nvim/vimrc b/etc/soft/nvim/vimrc index f955394..abfd5df 100644 --- a/etc/soft/nvim/vimrc +++ b/etc/soft/nvim/vimrc @@ -361,7 +361,6 @@ imap :make nmap :copen imap :copen -imap :copen nmap :echo system("robodoc &"):echo "MAKING DOCUMENTATION" imap :echo system("robodoc &"):echo "MAKING DOCUMENTATION" @@ -747,9 +746,63 @@ omap af (coc-funcobj-a) " GoTo code navigation. nmap gD :call CocActionAsync('jumpDefinition', 'split') nmap gy (coc-type-definition) -" nmap gi (coc-implementation) +nmap gI (coc-implementation) nmap gr (coc-references) +nmap rf (coc-refactor) +nmap rn (coc-rename) +nmap qf :CocFix + +nmap f :CocOutline + +" use [h and ]h to navigate between holes +nnoremap [h :call CocActionAsync('diagnosticPrevious', 'hint') +nnoremap ]h :call JumpToNextHole() + +" d to perform a pattern match, n to fill a hole +nnoremap d :set operatorfunc=WingmanDestructg@l +nnoremap N :set operatorfunc=WingmanFillHoleg@l +nnoremap r :set operatorfunc=WingmanRefineg@l +nnoremap c :set operatorfunc=WingmanUseCtorg@l +nnoremap a :set operatorfunc=WingmanDestructAllg@l + +function! s:JumpToNextHole() + call CocActionAsync('diagnosticNext', 'hint') +endfunction + +function! s:GotoNextHole() + " wait for the hole diagnostics to reload + sleep 500m + " and then jump to the next hole + normal 0 + call JumpToNextHole() +endfunction + +function! s:WingmanRefine(type) + call CocAction('codeAction', a:type, ['refactor.wingman.refine']) + call GotoNextHole() +endfunction + +function! s:WingmanDestruct(type) + call CocAction('codeAction', a:type, ['refactor.wingman.caseSplit']) + call GotoNextHole() +endfunction + +function! s:WingmanDestructAll(type) + call CocAction('codeAction', a:type, ['refactor.wingman.splitFuncArgs']) + call GotoNextHole() +endfunction + +function! s:WingmanFillHole(type) + call CocAction('codeAction', a:type, ['refactor.wingman.fillHole']) + call GotoNextHole() +endfunction + +function! s:WingmanUseCtor(type) + call CocAction('codeAction', a:type, ['refactor.wingman.useConstructor']) + call GotoNextHole() +endfunction + " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. @@ -786,6 +839,13 @@ let g:coc_snippet_prev = '' " HaskellConcealPlus {{{ +nnoremap . :call pointfree#suggestions() +vnoremap . :call pointfree#selection() + +" }}} + +" HaskellConcealPlus {{{ + " [ ] 'q' option to disable concealing of scientific constants (e.g. ฯ€) " [ ] 'โ„˜' option to disable concealing of powerset function " [ ] '๐’' option to disable String type to ๐’ concealing @@ -828,31 +888,11 @@ let hscoptions="Ax*Eerlโ†ฑw-Tt" " }}} -" {{{ vista.vim -let g:vista_default_executive = 'coc' -let g:vista_cursor_delay = 0 -let g:vista_echo_cursor_strategy = 'echo' -let g:vista_blink = [0, 0] - -let g:vista#renderer#enable_icon = 1 -let g:vista#renderer#icons = { -\ "file": "โ–ธ", -\ "function": "โ„ฑ", -\ "module": "โ„ณ", -\ "variable": "๐’ฑ", -\ "struct": "๐’ฎ", -\ "field": "๐•—", -\ } - -nmap f :Vista!! -" }}} - " {{{ goc lua << EOF local goc = require'nvim-goc' goc.setup({ verticalSplit = false }) - vim.api.nvim_command("command! Goc normal! :lua require('nvim-goc').Coverage()") vim.api.nvim_command("command! Gocc normal! :lua require('nvim-goc').ClearCoverage()") vim.api.nvim_command("command! Gocw normal! :lua cf()")