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