Skip to content

Commit

Permalink
fix(<Tab>): pressing <Tab> key doesn't freeze the terminal window
Browse files Browse the repository at this point in the history
  • Loading branch information
daUnknownCoder committed Feb 2, 2024
1 parent 2fddd7e commit 302d824
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lua/NeutronVim/plugins/Coding/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ return {
return false
end
end
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
vim.api.nvim_set_hl(0, "NeutronCmpNormal", { fg = "silver", bg = "NONE" })
vim.api.nvim_set_hl(0, "NeutronCmpBorder", { fg = "lightblue", bg = "NONE" })
vim.api.nvim_set_hl(0, "NeutronCmpCursorLine", { fg = "aqua", bg = "NONE", italic = true })
Expand Down Expand Up @@ -170,11 +166,9 @@ return {
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_back_space() then
feedkey("<Tab>", "i")
elseif has_words_before() then
cmp.complete()
feedkey(" ", "i")
else
vim.fn["codeium#Accept"]()
feedkey(" ", "i")
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(_)
Expand All @@ -183,9 +177,9 @@ return {
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
elseif check_back_space() then
feedkey("<C-d>", "i")
feedkey(" ", "i")
else
vim.fn["codeium#Accept"]()
feedkey(" ", "i")
end
end, { "i", "s" }),
},
Expand Down

0 comments on commit 302d824

Please sign in to comment.