Skip to content

Commit

Permalink
feat(tab): tab not working in between words (fixed)
Browse files Browse the repository at this point in the history
  • Loading branch information
daUnknownCoder committed Jan 24, 2024
1 parent c77ef73 commit b05fccb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/NeutronVim/plugins/Coding/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ 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 @@ -166,7 +170,9 @@ return {
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_back_space() then
feedkey("<Tab>", "n")
feedkey("<Tab>", "i")
elseif has_words_before() then
cmp.complete()
else
vim.fn["codeium#Accept"]()
end
Expand Down

0 comments on commit b05fccb

Please sign in to comment.