summaryrefslogtreecommitdiff
path: root/config/nvim/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'config/nvim/lua/plugins')
-rw-r--r--config/nvim/lua/plugins/apidocs.lua3
-rw-r--r--config/nvim/lua/plugins/autosave.lua38
-rw-r--r--config/nvim/lua/plugins/blankline.lua7
-rw-r--r--config/nvim/lua/plugins/codecompanion.lua89
-rw-r--r--config/nvim/lua/plugins/conform.lua11
-rw-r--r--config/nvim/lua/plugins/dap.lua3
-rw-r--r--config/nvim/lua/plugins/dap_go.lua51
-rw-r--r--config/nvim/lua/plugins/dapui.lua31
-rw-r--r--config/nvim/lua/plugins/goimpl.lua9
-rw-r--r--config/nvim/lua/plugins/headlines.lua5
-rw-r--r--config/nvim/lua/plugins/multicursor.lua76
-rw-r--r--config/nvim/lua/plugins/resize.lua30
-rw-r--r--config/nvim/lua/plugins/telescope.lua18
-rw-r--r--config/nvim/lua/plugins/tree.lua14
14 files changed, 174 insertions, 211 deletions
diff --git a/config/nvim/lua/plugins/apidocs.lua b/config/nvim/lua/plugins/apidocs.lua
index 9bc35da..2727c09 100644
--- a/config/nvim/lua/plugins/apidocs.lua
+++ b/config/nvim/lua/plugins/apidocs.lua
@@ -10,7 +10,4 @@ return {
-- require('apidocs').setup({picker = "snacks"})
-- Possible options are 'ui_select', 'telescope', and 'snacks'
end,
- keys = {
- { "<leader>sad", "<cmd>ApidocsOpen<cr>", desc = "Search Api Doc" },
- },
}
diff --git a/config/nvim/lua/plugins/autosave.lua b/config/nvim/lua/plugins/autosave.lua
index 069afbf..f6f280d 100644
--- a/config/nvim/lua/plugins/autosave.lua
+++ b/config/nvim/lua/plugins/autosave.lua
@@ -1,18 +1,12 @@
return {
"okuuva/auto-save.nvim",
enabled = true,
- cmd = "ASToggle", -- optional for lazy loading on command
- event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
+ cmd = "ASToggle",
+ event = { "InsertLeave", "TextChanged" },
opts = {
- enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
- trigger_events = { -- See :h events
- -- -- vim events that trigger an immediate save
- -- -- I'm disabling this, as it's autosaving when I leave the buffer and
- -- -- that's autoformatting stuff if on insert mode and following a tutorial
- -- -- Re-enabling this to only save if NOT in insert mode in the condition below
- -- immediate_save = { nil },
- immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, -- vim events that trigger an immediate save
- -- vim events that trigger a deferred save (saves after `debounce_delay`)
+ enabled = true,
+ trigger_events = {
+ immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" },
defer_save = {
"InsertLeave",
"TextChanged",
@@ -29,28 +23,12 @@ return {
{ "User", pattern = "SnacksPickerInputEnter" },
},
},
- -- function that takes the buffer handle and determines whether to save the current buffer or not
- -- return true: if buffer is ok to be saved
- -- return false: if it's not ok to be saved
- -- if set to `nil` then no specific condition is applied
condition = function(buf)
- -- Do not save when I'm in insert mode
- -- Do NOT ADD VISUAL MODE HERE or the cancel_deferred_save wont' work
- -- If I STAY in insert mode and switch to another app, like YouTube to
- -- take notes, the BufLeave or FocusLost immediate_save will be ignored
- -- and the save will not be triggered
local mode = vim.fn.mode()
if mode == "i" then
return false
end
- -- Disable auto-save for the harpoon plugin, otherwise it just opens and closes
- -- https://github.com/ThePrimeagen/harpoon/issues/434
- --
- -- don't save for `sql` file types
- -- I do this so when working with dadbod the file is not saved every time
- -- I make a change, and a SQL query executed
- -- Run `:set filetype?` on a dadbod query to make sure of the filetype
local filetype = vim.bo[buf].filetype
if filetype == "harpoon" or filetype == "mysql" then
return false
@@ -58,12 +36,10 @@ return {
return true
end,
- write_all_buffers = true, -- write all buffers when the current one meets `condition`
+ write_all_buffers = true,
noautocmd = false,
- lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details
- -- delay after which a pending save is executed (default 1000)
+ lockmarks = false,
debounce_delay = 2000,
- -- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable
debug = false,
},
}
diff --git a/config/nvim/lua/plugins/blankline.lua b/config/nvim/lua/plugins/blankline.lua
deleted file mode 100644
index b74d9e6..0000000
--- a/config/nvim/lua/plugins/blankline.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-return {
- "lukas-reineke/indent-blankline.nvim",
- main = "ibl",
- --@module "ibl"
- --@type ibl.config
- config = true,
-}
diff --git a/config/nvim/lua/plugins/codecompanion.lua b/config/nvim/lua/plugins/codecompanion.lua
new file mode 100644
index 0000000..a657d09
--- /dev/null
+++ b/config/nvim/lua/plugins/codecompanion.lua
@@ -0,0 +1,89 @@
+return {
+ "olimorris/codecompanion.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-treesitter/nvim-treesitter",
+ {
+ "MeanderingProgrammer/render-markdown.nvim",
+ ft = { "markdown", "codecompanion" },
+ },
+ {
+ "ravitemer/mcphub.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ },
+ build = "npm install -g mcp-hub@latest",
+ config = function()
+ require("mcphub").setup()
+ end,
+ },
+ },
+ opts = {
+ opts = {
+ log_level = "DEBUG", -- or "TRACE"
+ },
+ extensions = {
+ mcphub = {
+ callback = "mcphub.extensions.codecompanion",
+ opts = {
+ make_tools = true, -- Make individual tools (@server__tool) and server groups (@server) from MCP servers
+ show_server_tools_in_chat = true, -- Show individual tools in chat completion (when make_tools=true)
+ add_mcp_prefix_to_tool_names = false, -- Add mcp__ prefix (e.g `@mcp__github`, `@mcp__neovim__list_issues`)
+ show_result_in_chat = true, -- Show tool results directly in chat buffer
+ format_tool = nil, -- function(tool_name:string, tool: CodeCompanion.Agent.Tool) : string Function to format tool names to show in the chat buffer
+ -- MCP Resources
+ make_vars = true, -- Convert MCP resources to #variables for prompts
+ -- MCP Prompts
+ make_slash_commands = true, -- Add MCP prompts as /slash commands
+ },
+ },
+ },
+ strategies = {
+ chat = {
+ adapter = "scbt",
+ tools = {
+ opts = {
+ default_tools = {
+ "full_stack_dev",
+ "mcp",
+ },
+ },
+ opts = {
+ system_promt = "Ты полезный ассистент в редакторе neovim в плагине codecompanion. Основной зык программирования - go. Отвечай всегда на русском языке.",
+ },
+ },
+ },
+ inline = {
+ adapter = "scbt",
+ },
+ },
+ memory = {
+ opts = {
+ chat = {
+ enabled = true,
+ },
+ },
+ },
+ adapters = {
+ http = {
+ scbt = function()
+ return require("codecompanion.adapters").extend("openai_compatible", {
+ env = {
+ api_key = "cmd: age -d -i ~/.ssh/id_ed25519 ~/.openai-api-key.age",
+ url = "http://localhost:8888/api",
+ },
+
+ schema = {
+ model = {
+ default = "qwen3-235b-it",
+ choices = {
+ "qwen3-235b-it",
+ },
+ },
+ },
+ })
+ end,
+ },
+ },
+ },
+}
diff --git a/config/nvim/lua/plugins/conform.lua b/config/nvim/lua/plugins/conform.lua
index 3204d2d..3bd4e44 100644
--- a/config/nvim/lua/plugins/conform.lua
+++ b/config/nvim/lua/plugins/conform.lua
@@ -14,7 +14,7 @@ return {
graphql = { "prettier" },
lua = { "stylua" },
python = { "isort", "black" },
- go = { "gofmt" },
+ go = { "gofumpt" },
templ = { "templ" },
},
format_on_save = {
@@ -24,12 +24,5 @@ return {
},
},
keys = {
- {
- "<leader>mp",
- function()
- require("conform").format({ lsp_fallback = true, async = false, timeout_ms = 500 })
- end,
- desc = "Format file or range (in visual mode)",
- },
- },
+ },
}
diff --git a/config/nvim/lua/plugins/dap.lua b/config/nvim/lua/plugins/dap.lua
deleted file mode 100644
index ab44a1e..0000000
--- a/config/nvim/lua/plugins/dap.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-return {
- "mfussenegger/nvim-dap",
-}
diff --git a/config/nvim/lua/plugins/dap_go.lua b/config/nvim/lua/plugins/dap_go.lua
index 262aef8..0864da1 100644
--- a/config/nvim/lua/plugins/dap_go.lua
+++ b/config/nvim/lua/plugins/dap_go.lua
@@ -104,55 +104,4 @@ return {
{ text = "→", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
)
end,
- keys = {
- {
- "<F5>",
- function()
- require("dap").continue()
- end,
- silent = true,
- },
- {
- "<F17>", -- S-F5
- function()
- require("dap").restart()
- end,
- silent = true,
- },
- {
- "<F29>", -- C-F5
- function()
- require("dap").terminate()
- end,
- silent = true,
- },
- {
- "<F8>",
- function()
- require("dap").step_over()
- end,
- silent = true,
- },
- {
- "<F7>",
- function()
- require("dap").step_into()
- end,
- silent = true,
- },
- {
- "<F19>", -- S-F7
- function()
- require("dap").step_out()
- end,
- silent = true,
- },
- {
- "<A-b>",
- function()
- require("dap").toggle_breakpoint()
- end,
- silent = true,
- },
- },
}
diff --git a/config/nvim/lua/plugins/dapui.lua b/config/nvim/lua/plugins/dapui.lua
index 5d35e1e..8530fd1 100644
--- a/config/nvim/lua/plugins/dapui.lua
+++ b/config/nvim/lua/plugins/dapui.lua
@@ -4,37 +4,6 @@ return {
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
},
- keys = {
- {
- "<F6>",
- function()
- require("dapui").toggle()
- end,
- silent = true,
- },
- {
- "<Leader>dh",
- function()
- require("dap.ui.widgets").hover()
- end,
- silent = true,
- },
- {
- "<Leader>dp",
- function()
- require("dap.ui.widgets").preview()
- end,
- silent = true,
- },
- {
- "<F9>",
- function()
- local widgets = require("dap.ui.widgets")
- widgets.centered_float(widgets.scopes)
- end,
- silent = true,
- },
- },
opts = {
icons = {
expanded = "[-]",
diff --git a/config/nvim/lua/plugins/goimpl.lua b/config/nvim/lua/plugins/goimpl.lua
index 0b906fa..9d97fb6 100644
--- a/config/nvim/lua/plugins/goimpl.lua
+++ b/config/nvim/lua/plugins/goimpl.lua
@@ -9,13 +9,4 @@ return {
config = function()
require("telescope").load_extension("goimpl")
end,
- keys = {
- {
- "<leader>im",
- function()
- require("telescope").extensions.goimpl.goimpl({})
- end,
- desc = "Generate stub for interface on a type for golang",
- },
- },
}
diff --git a/config/nvim/lua/plugins/headlines.lua b/config/nvim/lua/plugins/headlines.lua
deleted file mode 100644
index 5d92245..0000000
--- a/config/nvim/lua/plugins/headlines.lua
+++ /dev/null
@@ -1,5 +0,0 @@
-return {
- "lukas-reineke/headlines.nvim",
- dependencies = "nvim-treesitter/nvim-treesitter",
- config = true,
- }
diff --git a/config/nvim/lua/plugins/multicursor.lua b/config/nvim/lua/plugins/multicursor.lua
new file mode 100644
index 0000000..0a762a8
--- /dev/null
+++ b/config/nvim/lua/plugins/multicursor.lua
@@ -0,0 +1,76 @@
+return {
+ "jake-stewart/multicursor.nvim",
+ branch = "1.0",
+ config = function()
+ local mc = require("multicursor-nvim")
+ mc.setup()
+
+ local set = vim.keymap.set
+
+ -- Add or skip cursor above/below the main cursor.
+ set({ "n", "x" }, "<A-up>", function()
+ mc.lineAddCursor(-1)
+ end )
+ set({ "n", "x" }, "<A-down>", function()
+ mc.lineAddCursor(1)
+ end )
+ set({ "n", "x" }, "<leader><up>", function()
+ mc.lineSkipCursor(-1)
+ end)
+ set({ "n", "x" }, "<leader><down>", function()
+ mc.lineSkipCursor(1)
+ end)
+
+ -- Add or skip adding a new cursor by matching word/selection
+ set({ "n", "x" }, "<leader>n", function()
+ mc.matchAddCursor(1)
+ end)
+ set({ "n", "x" }, "<leader>s", function()
+ mc.matchSkipCursor(1)
+ end)
+ set({ "n", "x" }, "<leader>N", function()
+ mc.matchAddCursor(-1)
+ end)
+ set({ "n", "x" }, "<leader>S", function()
+ mc.matchSkipCursor(-1)
+ end)
+
+ -- Add and remove cursors with control + left click.
+ set("n", "<c-leftmouse>", mc.handleMouse)
+ set("n", "<c-leftdrag>", mc.handleMouseDrag)
+ set("n", "<c-leftrelease>", mc.handleMouseRelease)
+
+ -- Disable and enable cursors.
+ set({ "n", "x" }, "<c-q>", mc.toggleCursor)
+
+ -- Mappings defined in a keymap layer only apply when there are
+ -- multiple cursors. This lets you have overlapping mappings.
+ mc.addKeymapLayer(function(layerSet)
+ -- Select a different cursor as the main one.
+ layerSet({ "n", "x" }, "<left>", mc.prevCursor)
+ layerSet({ "n", "x" }, "<right>", mc.nextCursor)
+
+ -- Delete the main cursor.
+ layerSet({ "n", "x" }, "<leader>x", mc.deleteCursor)
+
+ -- Enable and clear cursors using escape.
+ layerSet("n", "<esc>", function()
+ if not mc.cursorsEnabled() then
+ mc.enableCursors()
+ else
+ mc.clearCursors()
+ end
+ end)
+ end)
+
+ -- Customize how cursors look.
+ local hl = vim.api.nvim_set_hl
+ hl(0, "MultiCursorCursor", { reverse = true })
+ hl(0, "MultiCursorVisual", { link = "Visual" })
+ hl(0, "MultiCursorSign", { link = "SignColumn" })
+ hl(0, "MultiCursorMatchPreview", { link = "Search" })
+ hl(0, "MultiCursorDisabledCursor", { reverse = true })
+ hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
+ hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
+ end,
+}
diff --git a/config/nvim/lua/plugins/resize.lua b/config/nvim/lua/plugins/resize.lua
index 7e22517..bdb3ff6 100644
--- a/config/nvim/lua/plugins/resize.lua
+++ b/config/nvim/lua/plugins/resize.lua
@@ -1,34 +1,4 @@
return {
name = "resize",
dir = "~/.config/nvim/lua/myplugins",
- keys = {
- {
- "<C-A-Left>",
- function()
- require("myplugins.resize").ResizeLeft()
- end,
- silent = true,
- },
- {
- "<C-A-Right>",
- function()
- require("myplugins.resize").ResizeRight()
- end,
- silent = true,
- },
- {
- "<C-A-Up>",
- function()
- require("myplugins.resize").ResizeUp()
- end,
- silent = true,
- },
- {
- "<C-A-Down>",
- function()
- require("myplugins.resize").ResizeDown()
- end,
- silent = true,
- },
- },
}
diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua
index aabcd9c..018d95c 100644
--- a/config/nvim/lua/plugins/telescope.lua
+++ b/config/nvim/lua/plugins/telescope.lua
@@ -29,22 +29,4 @@ return {
},
})
end,
- keys = {
- { "<leader>ff", "<cmd>Telescope find_files<CR>", noremap = true, silent = true, desc = "Find files" },
- { "<leader>fg", "<cmd>Telescope live_grep<CR>", noremap = true, silent = true, desc = "Live grep" },
- {
- "<leader>fb",
- "<cmd>Telescope current_buffer_fuzzy_fund<CR>",
- noremap = true,
- silent = true,
- desc = "Find current file",
- },
- { "<F4>", "<cmd>Telescope buffers<CR>", noremap = true, silent = true, desc = "Find buffers" },
- { "<leader>gc", "<cmd>Telescope git_commits<CR>", noremap = true, silent = true },
- { "<leader>gs", "<cmd>Telescope git_status<CR>", noremap = true, silent = true },
- { "<leader>ch", "<cmd>Telescope commands_history<CR>", noremap = true, silent = true },
- { "<leader>e", "<cmd>Telescope diagnostics<CR>", noremap = true, silent = true },
- { "gi", "<cmd>Telescope lsp_implementations<CR>", noremap = true, silent = true },
- { "gr", "<cmd>Telescope lsp_references<CR>", noremap = true, silent = true },
- },
}
diff --git a/config/nvim/lua/plugins/tree.lua b/config/nvim/lua/plugins/tree.lua
index 3bf9eed..30c0599 100644
--- a/config/nvim/lua/plugins/tree.lua
+++ b/config/nvim/lua/plugins/tree.lua
@@ -37,18 +37,4 @@ return {
enable = true,
},
},
- keys = {
- {
- "<C-c>",
- function()
- local api = require("nvim-tree.api")
- local global_cwd = vim.fn.getcwd(-1, -1)
- api.tree.change_root(global_cwd)
- end,
- noremap = true,
- silent = true,
- desc = "Change tree root to CWD",
- },
- { "<F3>", ":NvimTreeToggle<CR>", noremap = true, silent = true, desc = "Toggle file tree" },
- },
}