Update some neovim keybinds
diff --git a/modules/neovim/binds/binds.vim b/modules/neovim/binds/binds.vim
index 916f3bc..279e45c 100644
--- a/modules/neovim/binds/binds.vim
+++ b/modules/neovim/binds/binds.vim
@@ -72,3 +72,31 @@
nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
nnoremap <silent> <C-d> <C-d>:redraw!<CR>
+
+function! s:start_delete(key)
+ let l:result = a:key
+ if !s:deleting
+ let l:result = "\<C-G>u".l:result
+ endif
+ let s:deleting = 1
+ return l:result
+endfunction
+
+function! s:check_undo_break(char)
+ if s:deleting
+ let s:deleting = 0
+ call feedkeys("\<BS>\<C-G>u".a:char, 'n')
+ endif
+endfunction
+
+augroup smartundo
+ autocmd!
+ autocmd InsertEnter * let s:deleting = 0
+ autocmd InsertCharPre * call s:check_undo_break(v:char)
+augroup END
+
+inoremap <expr> <BS> <SID>start_delete("\<BS>")
+inoremap <expr> <C-W> <SID>start_delete("\<C-W>")
+inoremap <expr> <C-U> <SID>start_delete("\<C-U>")
+
+" Undo stuff from https://vi.stackexchange.com/a/2377/38793
diff --git a/modules/neovim/coc/default.nix b/modules/neovim/coc/default.nix
index f50179e..aaebebe 100644
--- a/modules/neovim/coc/default.nix
+++ b/modules/neovim/coc/default.nix
@@ -126,9 +126,7 @@
];
extraPackages = with pkgs; [
nodejs
- rustc
go
- rust-analyzer
stylish-haskell
haskell-language-server
(haskellPackages.ghcWithPackages (pkgs: with pkgs; [
diff --git a/modules/neovim/coc/keybinds.vim b/modules/neovim/coc/keybinds.vim
index d45dce5..a97d6b7 100644
--- a/modules/neovim/coc/keybinds.vim
+++ b/modules/neovim/coc/keybinds.vim
@@ -6,9 +6,9 @@
nmap <silent> <Leader>fc <Plug>(coc-codeaction-cursor)
nmap <silent> <Leader>fr <Plug>(coc-rename)
nmap <silent> <Leader>fi <Plug>(coc-fix-current)
-nmap <silent> <Leader>gd <Plug>(coc-definition)
+nmap <silent> <Leader>gd <Plug>(coc-definition)zz
nmap <silent> <Leader>gt <Plug>(coc-type-definition)
-nmap <silent> <Leader>gi <Plug>(coc-implementation)
+nmap <silent> <Leader>gi <Plug>(coc-implementation)zz
nmap <silent> <Leader>gr <Plug>(coc-references)
nmap <Leader>fe <Cmd>CocCommand explorer<CR>
@@ -16,16 +16,20 @@
let g:UltiSnipsJumpForwardTrigger="<NUL>"
let g:UltiSnipsJumpBackwardTrigger="<NUL>"
-inoremap <silent><expr> <CR> coc#pum#visible() ? "\<C-g>u" . coc#pum#confirm() :
+inoremap <silent><expr> <CR> coc#pum#visible() ? "\<C-G>u" . coc#pum#confirm() :
\ coc#jumpable() ? "\<Esc>:call coc#snippet#next()\<CR>" :
\ 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() :
\ tablemode#table#IsTable('.') ? "<Esc>$a<CR>" :
- \ "\<Plug>(PearTreeExpand)"
+ \ "\<C-G>u\<Plug>(PearTreeExpand)"
inoremap <silent><expr> <S-CR> tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('k')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" . mode() : "\<S-CR>"
-inoremap <silent><expr> <Tab> coc#pum#visible() ? coc#pum#next(0) :
- \ coc#expandableOrJumpable() ? "\<C-g>u\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
+let g:codeium_no_map_tab = 1
+let g:codeium_tab_fallback = ""
+inoremap <silent><expr> <Tab>
+ \ coc#pum#visible() ? coc#pum#next(0) :
+ \ coc#expandableOrJumpable() ? "\<C-G>u\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
+ \ codeium#Accept() != "" ? "\<C-G>u" . codeium#Accept() :
\ pear_tree#GetSurroundingPair() != [] ? pear_tree#insert_mode#JumpOut() :
\ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('l')\<CR>" . mode() :
\ CheckBackSpace() ? "\<TAB>" : coc#refresh()
@@ -44,7 +48,7 @@
nnoremap <silent><expr> <CR> coc#jumpable() ?
\ ":call coc#snippet#next()\<CR>" :
\ tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('j')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" :
- \ "\<CR>"
+ \ "\<C-G>u\<CR>"
nnoremap <silent><expr> <S-CR> tablemode#table#IsTable('.') ? "\<Esc>:call tablemode#spreadsheet#cell#Motion('k')\<CR>:call tablemode#spreadsheet#MoveToStartOfCell()\<CR>" : "\<S-CR>"
@@ -61,7 +65,7 @@
snoremap <silent><expr> <CR> coc#jumpable() ?
\ "\<Esc>:call coc#snippet#next()\<CR>" :
- \ "\<CR>"
+ \ "\<C-G>u\<CR>"
snoremap <silent><expr> <Tab> coc#jumpable() ?
\ "\<Esc>:call coc#snippet#next()\<CR>" :