blob: d4b583cb61412d2244b73e0e2b565054fcf1ec9f [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 Greya7feb6e2022-08-26 06:51:55 +01009nmap <Leader>fe <Cmd>CocCommand explorer<CR>
10
Skyler Greyf066b512022-10-31 00:02:48 +000011let g:UltiSnipsExpandTrigger="<NUL>"
12let g:UltiSnipsJumpForwardTrigger="<NUL>"
13let g:UltiSnipsJumpBackwardTrigger="<NUL>"
Skyler Grey0c024ef2022-10-31 00:17:14 +000014
Skyler Greye9e45852022-10-31 00:16:58 +000015inoremap <silent><expr> <CR> coc#pum#visible() ? "\<C-g>u" . coc#pum#confirm() :
Skyler Grey0c024ef2022-10-31 00:17:14 +000016 \ 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 Greye9e45852022-10-31 00:16:58 +000019 \ "\<Plug>(PearTreeExpand)"
Skyler Grey0c024ef2022-10-31 00:17:14 +000020
21inoremap <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 Grey81f4af62022-10-31 00:10:52 +000023inoremap <silent><expr> <Tab> coc#pum#visible() ? coc#pum#next(0) :
Skyler Greye9e45852022-10-31 00:16:58 +000024 \ coc#expandableOrJumpable() ? "\<C-g>u\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000025 \ 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 Grey81f4af62022-10-31 00:10:52 +000028
29function! CheckBackSpace() abort
30 let col = col('.') - 1
31 return !col || getline('.')[col - 1] =~# '\s'
32endfunction
33
Skyler Greye9e45852022-10-31 00:16:58 +000034inoremap <silent><expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(0) :
Skyler Grey0c024ef2022-10-31 00:17:14 +000035 \ coc#jumpable() ? "\<Esc>:call coc#snippet#prev()\<CR>" :
36 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" . mode() :
Skyler Grey8fd63d02022-10-31 00:26:44 +000037 \ "\<Plug>(PearTreeJump)"
Skyler Grey81f4af62022-10-31 00:10:52 +000038xnoremap <silent> <Tab> <Plug>(coc-snippets-select)
Skyler Greyf066b512022-10-31 00:02:48 +000039
Skyler Greye9e45852022-10-31 00:16:58 +000040nnoremap <silent><expr> <CR> coc#jumpable() ?
41 \ ":call coc#snippet#next()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000042 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('j')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000043 \ "\<CR>"
Skyler Greyf066b512022-10-31 00:02:48 +000044
Skyler Grey0c024ef2022-10-31 00:17:14 +000045nnoremap <silent><expr> <S-CR> tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('k')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" : "\<S-CR>"
46
Skyler Greye9e45852022-10-31 00:16:58 +000047nnoremap <silent><expr> <Tab> coc#jumpable() ?
48 \ ":call coc#snippet#next()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000049 \ pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() :
50 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('l')\<CR>" :
51 \ "\<Tab>"
Skyler Greyf066b512022-10-31 00:02:48 +000052
Skyler Greye9e45852022-10-31 00:16:58 +000053nnoremap <silent><expr> <S-Tab> coc#jumpable() ?
54 \ ":call coc#snippet#prev()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000055 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000056 \ "\<S-Tab>"
57
58snoremap <silent><expr> <CR> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000059 \ "\<Esc>:call coc#snippet#next()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000060 \ "\<CR>"
61
62snoremap <silent><expr> <Tab> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000063 \ "\<Esc>:call coc#snippet#next()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000064 \ (pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() : "\<Tab>")
65
66snoremap <silent><expr> <S-Tab> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000067 \ "\<Esc>:call coc#snippet#prev()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000068 \ "\<S-Tab>"
Skyler Greyf066b512022-10-31 00:02:48 +000069
Skyler Grey0c024ef2022-10-31 00:17:14 +000070noremap <C-CR> <CR>
71
72nnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
73nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
74inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<C-f>"
75inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<C-b>"
76
Skyler Greya7feb6e2022-08-26 06:51:55 +010077function! s:show_documentation()
78if (index(['vim','help'], &filetype) >= 0)
79execute 'h '.expand('<cword>')
80else
81call CocAction('doHover')
82endif
83endfunction
84
85nnoremap <silent> K :call <SID>show_documentation()<CR>
Skyler Grey3d1b4502022-10-31 00:11:11 +000086
87command Snippets CocFzfList snippets