nixos-private-dots/nvim/lua/custom/plugins/ai.lua
2026-02-25 05:06:53 +03:00

39 lines
1.9 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- :NeoCodeium chat - opens browser with the Windsurf Chat
-- :NeoCodeium restart - restarts the server (useful if the server stops responding for any reason).
-- :NeoCodeium toggle_buffer - toggles NeoCodeium completion in the current buffer.
-- :NeoCodeium[!] toggle - toggles NeoCodeium completion. Convey the bang to disable command.
return {
'monkoose/neocodeium',
event = 'VeryLazy',
config = function()
local neocodeium = require 'neocodeium'
neocodeium.setup {
filter = function(bufnr)
-- отключаем в .env по имени файла
local name = vim.api.nvim_buf_get_name(bufnr)
if vim.endswith(name, '.env') then
return false
end
-- отключаем в txt, markdown, пустом filetype и nix
-- узнать filetype можно через `:set filetype?`
local ft = vim.bo[bufnr].filetype
if ft == 'txt' or ft == 'markdown' or ft == 'text' or ft == '' or ft == 'nix' then
return false
end
return true
end,
}
-- Бинды (в insert mode) ('<A-' и '<M-' это оба 'Alt')
vim.keymap.set('i', '<A-Tab>', neocodeium.accept, { desc = 'Accept NeoCodeium suggestion' })
vim.keymap.set('i', '<A-c>', neocodeium.clear, { desc = 'Clear suggestion' })
vim.keymap.set('i', '<A-Right>', neocodeium.accept_word, { desc = 'Accept next word (NeoCodeium)' })
vim.keymap.set('i', '<A-Left>', neocodeium.accept_line, { desc = 'Accept next line (NeoCodeium)' })
vim.keymap.set('i', '<A-l>', neocodeium.accept_word, { desc = 'Accept next word (h j k l style)' })
vim.keymap.set('i', '<A-h>', neocodeium.accept_line, { desc = 'Accept next line (h j k l style)' })
end,
}