blob: cf0615806c7f6fe1f05dc01fb8d5054ad635dabc [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 Grey9febe7b2023-01-25 21:31:33 +00009nmap <silent> <Leader>gd <Plug>(coc-definition)zz
Skyler Greyfab867f2023-01-25 21:45:01 +000010nmap <silent> <Leader>gt <Plug>(coc-type-definition)
Skyler Grey9febe7b2023-01-25 21:31:33 +000011nmap <silent> <Leader>gi <Plug>(coc-implementation)zz
Skyler Greyfab867f2023-01-25 21:45:01 +000012nmap <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 Grey9febe7b2023-01-25 21:31:33 +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 Grey48e12a42023-02-13 06:51:56 +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 Grey9febe7b2023-01-25 21:31:33 +000027let g:codeium_no_map_tab = 1
28let g:codeium_tab_fallback = ""
29inoremap <silent><expr> <Tab>
30 \ coc#pum#visible() ? coc#pum#next(0) :
Skyler Grey48e12a42023-02-13 06:51:56 +000031 \ coc#expandableOrJumpable() ? "\<C-G>u<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000032 \ pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() :
33 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('l')\<CR>" . mode() :
34 \ CheckBackSpace() ? "\<TAB>" : coc#refresh()
Skyler Grey81f4af62022-10-31 00:10:52 +000035
36function! CheckBackSpace() abort
37 let col = col('.') - 1
38 return !col || getline('.')[col - 1] =~# '\s'
39endfunction
40
Skyler Greye9e45852022-10-31 00:16:58 +000041inoremap <silent><expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(0) :
Skyler Grey0c024ef2022-10-31 00:17:14 +000042 \ coc#jumpable() ? "\<Esc>:call coc#snippet#prev()\<CR>" :
43 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" . mode() :
Skyler Grey48e12a42023-02-13 06:51:56 +000044 \ codeium#Accept() != "" ? "\<C-G>u" . codeium#Accept() :
Skyler Grey8fd63d02022-10-31 00:26:44 +000045 \ "\<Plug>(PearTreeJump)"
Skyler Grey48e12a42023-02-13 06:51:56 +000046
Skyler Grey81f4af62022-10-31 00:10:52 +000047xnoremap <silent> <Tab> <Plug>(coc-snippets-select)
Skyler Greyf066b512022-10-31 00:02:48 +000048
Skyler Greye9e45852022-10-31 00:16:58 +000049nnoremap <silent><expr> <CR> coc#jumpable() ?
50 \ ":call coc#snippet#next()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000051 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('j')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" :
Skyler Grey48e12a42023-02-13 06:51:56 +000052 \ "\<CR>"
Skyler Greyf066b512022-10-31 00:02:48 +000053
Skyler Grey0c024ef2022-10-31 00:17:14 +000054nnoremap <silent><expr> <S-CR> tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('k')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" : "\<S-CR>"
55
Skyler Greye9e45852022-10-31 00:16:58 +000056nnoremap <silent><expr> <Tab> coc#jumpable() ?
57 \ ":call coc#snippet#next()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000058 \ pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() :
59 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('l')\<CR>" :
60 \ "\<Tab>"
Skyler Greyf066b512022-10-31 00:02:48 +000061
Skyler Greye9e45852022-10-31 00:16:58 +000062nnoremap <silent><expr> <S-Tab> coc#jumpable() ?
63 \ ":call coc#snippet#prev()\<CR>" :
Skyler Grey0c024ef2022-10-31 00:17:14 +000064 \ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('h')\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000065 \ "\<S-Tab>"
66
67snoremap <silent><expr> <CR> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000068 \ "\<Esc>:call coc#snippet#next()\<CR>" :
Skyler Grey48e12a42023-02-13 06:51:56 +000069 \ "\<CR>"
Skyler Greye9e45852022-10-31 00:16:58 +000070
71snoremap <silent><expr> <Tab> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000072 \ "\<Esc>:call coc#snippet#next()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000073 \ (pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() : "\<Tab>")
74
75snoremap <silent><expr> <S-Tab> coc#jumpable() ?
Skyler Grey0c024ef2022-10-31 00:17:14 +000076 \ "\<Esc>:call coc#snippet#prev()\<CR>" :
Skyler Greye9e45852022-10-31 00:16:58 +000077 \ "\<S-Tab>"
Skyler Greyf066b512022-10-31 00:02:48 +000078
Skyler Grey0c024ef2022-10-31 00:17:14 +000079noremap <C-CR> <CR>
80
Skyler Grey0c024ef2022-10-31 00:17:14 +000081inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<C-f>"
82inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<C-b>"
83
Skyler Greya7feb6e2022-08-26 06:51:55 +010084function! s:show_documentation()
85if (index(['vim','help'], &filetype) >= 0)
86execute 'h '.expand('<cword>')
87else
88call CocAction('doHover')
89endif
90endfunction
91
92nnoremap <silent> K :call <SID>show_documentation()<CR>
Skyler Grey3d1b4502022-10-31 00:11:11 +000093
94command Snippets CocFzfList snippets