1
0
Fork 0

set up and disable tabnine

This commit is contained in:
Luca Bilke 2024-03-06 15:34:12 +01:00
commit 6b11c3e946
4 changed files with 48 additions and 19 deletions
.config/nvim/lua/plugins

View file

@ -64,6 +64,7 @@ M.opts = function()
completion = cmp.config.window.bordered(border_opts), completion = cmp.config.window.bordered(border_opts),
documentation = cmp.config.window.bordered(border_opts), documentation = cmp.config.window.bordered(border_opts),
}, },
-- TODO: Move to config.keymaps
mapping = { mapping = {
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), ["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), ["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),

View file

@ -25,4 +25,5 @@ return {
require("plugins.misc.ufo"), require("plugins.misc.ufo"),
require("plugins.misc.vimtex"), require("plugins.misc.vimtex"),
require("plugins.misc.which-key"), require("plugins.misc.which-key"),
-- require("plugins.misc.tabnine"),
} }

View file

@ -17,17 +17,17 @@ M.opts = function()
end, end,
} }
local function search_result() -- local function search_result()
if vim.v.hlsearch == 0 then -- if vim.v.hlsearch == 0 then
return "" -- return ""
end -- end
local last_search = vim.fn.getreg("/") -- local last_search = vim.fn.getreg("/")
if not last_search or last_search == "" then -- if not last_search or last_search == "" then
return "" -- return ""
end -- end
local searchcount = vim.fn.searchcount({ maxcount = 9999 }) -- local searchcount = vim.fn.searchcount({ maxcount = 9999 })
return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")" -- return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")"
end -- end
local config = { local config = {
options = { options = {
@ -82,8 +82,8 @@ M.opts = function()
S = colors.orange, S = colors.orange,
[string.char(19)] = colors.orange, [string.char(19)] = colors.orange,
ic = colors.yellow, ic = colors.yellow,
R = colors.violet, R = colors.purple,
Rv = colors.violet, Rv = colors.purple,
cv = colors.red, cv = colors.red,
ce = colors.red, ce = colors.red,
r = colors.cyan, r = colors.cyan,
@ -150,11 +150,16 @@ M.opts = function()
-- color = { fg = colors.yellow } -- color = { fg = colors.yellow }
-- } -- }
ins_right({ -- ins_right({
search_result, -- search_result,
color = { fg = colors.white }, -- color = { fg = colors.fg },
padding = { left = 1 }, -- padding = { left = 1 },
}) -- })
-- ins_right({
-- 'tabnine',
-- color = { fg = colors.green1, gui = "bold" },
-- })
ins_right({ ins_right({
function() function()
@ -172,7 +177,7 @@ M.opts = function()
end end
return msg:sub(3) return msg:sub(3)
end, end,
color = { fg = colors.blue, gui = "bold" }, color = { fg = colors.green2, gui = "bold" },
}) })
ins_right({ ins_right({

View file

@ -0,0 +1,22 @@
local M = { "codota/tabnine-nvim" }
M.build = "./dl_binaries.sh"
M.event = { "BufReadPost", "BufNewFile", "BufNew" }
M.main = "tabnine"
M.opts = function()
local colors = require("tokyonight.colors").setup({ transform = true })
return {
disable_auto_comment = true,
accept_keymap = "<Tab>",
dismiss_keymap = "<C-]>",
debounce_ms = 800,
suggestion_color = { gui = colors.fg_gutter, cterm = 244 },
exclude_filetypes = { "TelescopePrompt", "NvimTree" },
log_file_path = nil, -- absolute path to Tabnine log file
}
end
return M