Skyler Grey | 3d1b450 | 2022-10-31 00:11:11 +0000 | [diff] [blame] | 1 | nmap <silent> ]c :silent! call CocAction('diagnosticNext')<cr> |
| 2 | nmap <silent> [c :silent! call CocAction('diagnosticPrevious')<cr> |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 3 | nmap <silent> <Leader>fs <Plug>(coc-codeaction-selected) |
Skyler Grey | 97efa1a | 2022-10-30 23:10:37 +0000 | [diff] [blame] | 4 | nmap <silent> <Leader>fb <Plug>(coc-codeaction) |
| 5 | nmap <silent> <Leader>ff <Plug>(coc-codeaction-cursor) |
| 6 | nmap <silent> <Leader>fc <Plug>(coc-codeaction-cursor) |
| 7 | nmap <silent> <Leader>fr <Plug>(coc-rename) |
| 8 | nmap <silent> <Leader>fi <Plug>(coc-fix-current) |
Skyler Grey | fab867f | 2023-01-25 21:45:01 +0000 | [diff] [blame] | 9 | nmap <silent> <Leader>gd <Plug>(coc-definition) |
| 10 | nmap <silent> <Leader>gt <Plug>(coc-type-definition) |
| 11 | nmap <silent> <Leader>gi <Plug>(coc-implementation) |
| 12 | nmap <silent> <Leader>gr <Plug>(coc-references) |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 13 | nmap <Leader>fe <Cmd>CocCommand explorer<CR> |
| 14 | |
Skyler Grey | f066b51 | 2022-10-31 00:02:48 +0000 | [diff] [blame] | 15 | let g:UltiSnipsExpandTrigger="<NUL>" |
| 16 | let g:UltiSnipsJumpForwardTrigger="<NUL>" |
| 17 | let g:UltiSnipsJumpBackwardTrigger="<NUL>" |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 18 | |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 19 | inoremap <silent><expr> <CR> coc#pum#visible() ? "\<C-g>u" . coc#pum#confirm() : |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 20 | \ coc#jumpable() ? "\<Esc>:call coc#snippet#next()\<CR>" : |
| 21 | \ tablemode#table#IsTable('.') && !(tablemode#spreadsheet#GetLastRow(".") == line('.')) && !(tablemode#spreadsheet#GetLastRow(".") == 0) ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('j')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" . mode() : |
| 22 | \ tablemode#table#IsTable('.') ? "<Esc>$a<CR>" : |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 23 | \ "\<Plug>(PearTreeExpand)" |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 24 | |
| 25 | inoremap <silent><expr> <S-CR> tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('k')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" . mode() : "\<S-CR>" |
| 26 | |
Skyler Grey | 81f4af6 | 2022-10-31 00:10:52 +0000 | [diff] [blame] | 27 | inoremap <silent><expr> <Tab> coc#pum#visible() ? coc#pum#next(0) : |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 28 | \ coc#expandableOrJumpable() ? "\<C-g>u\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" : |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 29 | \ pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() : |
| 30 | \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('l')\<CR>" . mode() : |
| 31 | \ CheckBackSpace() ? "\<TAB>" : coc#refresh() |
Skyler Grey | 81f4af6 | 2022-10-31 00:10:52 +0000 | [diff] [blame] | 32 | |
| 33 | function! CheckBackSpace() abort |
| 34 | let col = col('.') - 1 |
| 35 | return !col || getline('.')[col - 1] =~# '\s' |
| 36 | endfunction |
| 37 | |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 38 | inoremap <silent><expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(0) : |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 39 | \ coc#jumpable() ? "\<Esc>:call coc#snippet#prev()\<CR>" : |
| 40 | \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" . mode() : |
Skyler Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame] | 41 | \ "\<Plug>(PearTreeJump)" |
Skyler Grey | 81f4af6 | 2022-10-31 00:10:52 +0000 | [diff] [blame] | 42 | xnoremap <silent> <Tab> <Plug>(coc-snippets-select) |
Skyler Grey | f066b51 | 2022-10-31 00:02:48 +0000 | [diff] [blame] | 43 | |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 44 | nnoremap <silent><expr> <CR> coc#jumpable() ? |
| 45 | \ ":call coc#snippet#next()\<CR>" : |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 46 | \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('j')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" : |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 47 | \ "\<CR>" |
Skyler Grey | f066b51 | 2022-10-31 00:02:48 +0000 | [diff] [blame] | 48 | |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 49 | nnoremap <silent><expr> <S-CR> tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('k')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" : "\<S-CR>" |
| 50 | |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 51 | nnoremap <silent><expr> <Tab> coc#jumpable() ? |
| 52 | \ ":call coc#snippet#next()\<CR>" : |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 53 | \ pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() : |
| 54 | \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('l')\<CR>" : |
| 55 | \ "\<Tab>" |
Skyler Grey | f066b51 | 2022-10-31 00:02:48 +0000 | [diff] [blame] | 56 | |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 57 | nnoremap <silent><expr> <S-Tab> coc#jumpable() ? |
| 58 | \ ":call coc#snippet#prev()\<CR>" : |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 59 | \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" : |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 60 | \ "\<S-Tab>" |
| 61 | |
| 62 | snoremap <silent><expr> <CR> coc#jumpable() ? |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 63 | \ "\<Esc>:call coc#snippet#next()\<CR>" : |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 64 | \ "\<CR>" |
| 65 | |
| 66 | snoremap <silent><expr> <Tab> coc#jumpable() ? |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 67 | \ "\<Esc>:call coc#snippet#next()\<CR>" : |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 68 | \ (pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() : "\<Tab>") |
| 69 | |
| 70 | snoremap <silent><expr> <S-Tab> coc#jumpable() ? |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 71 | \ "\<Esc>:call coc#snippet#prev()\<CR>" : |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 72 | \ "\<S-Tab>" |
Skyler Grey | f066b51 | 2022-10-31 00:02:48 +0000 | [diff] [blame] | 73 | |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 74 | noremap <C-CR> <CR> |
| 75 | |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 76 | inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<C-f>" |
| 77 | inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<C-b>" |
| 78 | |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 79 | function! s:show_documentation() |
| 80 | if (index(['vim','help'], &filetype) >= 0) |
| 81 | execute 'h '.expand('<cword>') |
| 82 | else |
| 83 | call CocAction('doHover') |
| 84 | endif |
| 85 | endfunction |
| 86 | |
| 87 | nnoremap <silent> K :call <SID>show_documentation()<CR> |
Skyler Grey | 3d1b450 | 2022-10-31 00:11:11 +0000 | [diff] [blame] | 88 | |
| 89 | command Snippets CocFzfList snippets |