blob: d45dce5e8724505bc6960db660f392413efc56be [file] [log] [blame]
Skyler Grey3d1b4502022-10-31 00:11:11 +00001nmap <silent> ]c :silent! call CocAction('diagnosticNext')<cr>
2nmap <silent> [c :silent! call CocAction('diagnosticPrevious')<cr>
Skyler Greya7feb6e2022-08-26 06:51:55 +01003nmap <silent> <Leader>fs <Plug>(coc-codeaction-selected)
Skyler Grey97efa1a2022-10-30 23:10:37 +00004nmap <silent> <Leader>fb <Plug>(coc-codeaction)
5nmap <silent> <Leader>ff <Plug>(coc-codeaction-cursor)
6nmap <silent> <Leader>fc <Plug>(coc-codeaction-cursor)
7nmap <silent> <Leader>fr <Plug>(coc-rename)
8nmap <silent> <Leader>fi <Plug>(coc-fix-current)
Skyler Greyfab867f2023-01-25 21:45:01 +00009nmap <silent> <Leader>gd <Plug>(coc-definition)
10nmap <silent> <Leader>gt <Plug>(coc-type-definition)
11nmap <silent> <Leader>gi <Plug>(coc-implementation)
12nmap <silent> <Leader>gr <Plug>(coc-references)
Skyler Greya7feb6e2022-08-26 06:51:55 +010013nmap <Leader>fe <Cmd>CocCommand explorer<CR>
14
Skyler Greyf066b512022-10-31 00:02:48 +000015let g:UltiSnipsExpandTrigger="<NUL>"
16let g:UltiSnipsJumpForwardTrigger="<NUL>"
17let g:UltiSnipsJumpBackwardTrigger="<NUL>"
Skyler Grey0c024ef2022-10-31 00:17:14 +000018
Skyler Greye9e45852022-10-31 00:16:58 +000019inoremap <silent><expr> <CR> coc#pum#visible() ? "\<C-g>u" . coc#pum#confirm() :
Skyler Grey0c024ef2022-10-31 00:17:14 +000020 \ 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 Greye9e45852022-10-31 00:16:58 +000023 \ "\<Plug>(PearTreeExpand)"
Skyler Grey0c024ef2022-10-31 00:17:14 +000024
25inoremap <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 Grey81f4af62022-10-31 00:10:52 +000027inoremap <silent><expr> <Tab> coc#pum#visible() ? coc#pum#next(0) :
Skyler Greye9e45852022-10-31 00:16:58 +000028 \ coc#expandableOrJumpable() ? "\<C-g>u\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000029 \ 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 Grey81f4af62022-10-31 00:10:52 +000032
33function! CheckBackSpace() abort
34 let col = col('.') - 1
35 return !col || getline('.')[col - 1] =~# '\s'
36endfunction
37
Skyler Greye9e45852022-10-31 00:16:58 +000038inoremap <silent><expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(0) :
Skyler Grey0c024ef2022-10-31 00:17:14 +000039 \ coc#jumpable() ? "\<Esc>:call coc#snippet#prev()\<CR>" :
40 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" . mode() :
Skyler Grey8fd63d02022-10-31 00:26:44 +000041 \ "\<Plug>(PearTreeJump)"
Skyler Grey81f4af62022-10-31 00:10:52 +000042xnoremap <silent> <Tab> <Plug>(coc-snippets-select)
Skyler Greyf066b512022-10-31 00:02:48 +000043
Skyler Greye9e45852022-10-31 00:16:58 +000044nnoremap <silent><expr> <CR> coc#jumpable() ?
45 \ ":call coc#snippet#next()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000046 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('j')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000047 \ "\<CR>"
Skyler Greyf066b512022-10-31 00:02:48 +000048
Skyler Grey0c024ef2022-10-31 00:17:14 +000049nnoremap <silent><expr> <S-CR> tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('k')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" : "\<S-CR>"
50
Skyler Greye9e45852022-10-31 00:16:58 +000051nnoremap <silent><expr> <Tab> coc#jumpable() ?
52 \ ":call coc#snippet#next()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000053 \ pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() :
54 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('l')\<CR>" :
55 \ "\<Tab>"
Skyler Greyf066b512022-10-31 00:02:48 +000056
Skyler Greye9e45852022-10-31 00:16:58 +000057nnoremap <silent><expr> <S-Tab> coc#jumpable() ?
58 \ ":call coc#snippet#prev()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000059 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000060 \ "\<S-Tab>"
61
62snoremap <silent><expr> <CR> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000063 \ "\<Esc>:call coc#snippet#next()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000064 \ "\<CR>"
65
66snoremap <silent><expr> <Tab> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000067 \ "\<Esc>:call coc#snippet#next()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000068 \ (pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() : "\<Tab>")
69
70snoremap <silent><expr> <S-Tab> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000071 \ "\<Esc>:call coc#snippet#prev()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000072 \ "\<S-Tab>"
Skyler Greyf066b512022-10-31 00:02:48 +000073
Skyler Grey0c024ef2022-10-31 00:17:14 +000074noremap <C-CR> <CR>
75
Skyler Grey0c024ef2022-10-31 00:17:14 +000076inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<C-f>"
77inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<C-b>"
78
Skyler Greya7feb6e2022-08-26 06:51:55 +010079function! s:show_documentation()
80if (index(['vim','help'], &filetype) >= 0)
81execute 'h '.expand('<cword>')
82else
83call CocAction('doHover')
84endif
85endfunction
86
87nnoremap <silent> K :call <SID>show_documentation()<CR>
Skyler Grey3d1b4502022-10-31 00:11:11 +000088
89command Snippets CocFzfList snippets