Skip to content

Commit be0c1c8

Browse files
fix(coc-nvim): resolve <CR> conflicts and enable proper insert-mode completion (#1552)
* fix(coc): disable nvim-autopairs and add default insert-mode keybindings * Update lua/astrocommunity/lsp/coc-nvim/init.lua * refactor: remove unneeded if test --------- Co-authored-by: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Co-authored-by: Uzair Aftab <uzaaft@outlook.com>
1 parent b3ed1de commit be0c1c8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lua/astrocommunity/lsp/coc-nvim/init.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ return {
7272
end,
7373
desc = "Hover symbol details",
7474
}
75+
76+
maps.i["<C-Space>"] = { "coc#refresh()", desc = "Trigger completion", expr = true, silent = true }
77+
maps.i["<CR>"] = {
78+
[[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]],
79+
expr = true,
80+
noremap = true,
81+
silent = true,
82+
}
83+
maps.i["<Tab>"] =
84+
{ [[coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"]], expr = true, noremap = true, silent = true }
85+
maps.i["<S-Tab>"] =
86+
{ [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], expr = true, noremap = true, silent = true }
7587
end,
7688
},
7789
specs = {
@@ -164,5 +176,7 @@ return {
164176
{ "rafamadriz/friendly-snippets", optional = true, enabled = false },
165177
-- blink
166178
{ "Saghen/blink.cmp", optional = true, enabled = false },
179+
-- autopairs
180+
{ "windwp/nvim-autopairs", optional = true, enabled = false },
167181
},
168182
}

0 commit comments

Comments
 (0)