diff --git a/config/nvim/after/plugin/autocmds.lua b/config/nvim/after/plugin/autocmds.lua index 1586a45..34727c6 100644 --- a/config/nvim/after/plugin/autocmds.lua +++ b/config/nvim/after/plugin/autocmds.lua @@ -4,6 +4,18 @@ vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHo command = "checktime", }) +-- get terminal to follow directory +vim.api.nvim_create_autocmd({ 'TermRequest' }, { + desc = 'Handles OSC 7 dir change requests', + callback = function(ev) + local pwd, n = string.gsub(ev.data.sequence, '\027]7;file://[^/]*', '') + if n <= 0 then return end + if vim.fn.isdirectory(pwd) == 0 then return end + if vim.api.nvim_get_current_buf() ~= ev.buf then return end + vim.cmd.cd(pwd) + end +}) + -- Check if we need to reload the file when it changed vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { desc = 'Check time', diff --git a/config/nvim/after/plugin/keymaps.lua b/config/nvim/after/plugin/keymaps.lua index 535a252..64088b6 100644 --- a/config/nvim/after/plugin/keymaps.lua +++ b/config/nvim/after/plugin/keymaps.lua @@ -63,10 +63,8 @@ vim.keymap.set('n', 'ex', "!chmod +x %", { desc = "Make file ex vim.keymap.set('n', "eL", "source %", { desc = "Source current buffer" }) vim.keymap.set('n', "el", ".lua", { desc = "Source current line" }) vim.keymap.set('v', "el", "lua", { desc = "Source current line" }) -vim.keymap.set('n', 'xu', 'Lazy sync', { desc = 'Lazy sync' }) - -vim.keymap.set("n", "cx", function() +vim.keymap.set("n", "ey", function() local file = vim.fn.expand "%" local line = vim.fn.line "." vim.fn.setreg("+", string.format("%s:%d", file, line)) diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 50d98b7..8ecf0e6 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -75,7 +75,7 @@ vim.opt.signcolumn = "yes" vim.opt.wrap = false vim.opt.scrolloff = 8 vim.opt.sidescrolloff = 8 -vim.opt.shell = "/bin/bash" +vim.opt.shell = vim.env.SHELL vim.opt.sessionoptions = { "blank", "buffers", "curdir", "tabpages", "winsize", "winpos", "terminal", "localoptions", "help", "skiprtp", "folds" } vim.opt.virtualedit = "block" vim.opt.wildmode = "longest:full,full" @@ -114,95 +114,96 @@ vim.filetype.add({ vim.pack.add({ { src = "https://github.com/folke/snacks.nvim" }, + { src = "https://github.com/folke/trouble.nvim" }, { src = "https://github.com/olimorris/codecompanion.nvim" }, + { src = 'https://github.com/Civitasv/cmake-tools.nvim' }, + { src = 'https://github.com/Davidyz/VectorCode' }, + { src = 'https://github.com/Glhou/jjsigns.nvim', version = 'fix/skip-extra-lines' }, + { src = 'https://github.com/HakonHarnes/img-clip.nvim' }, + { src = 'https://github.com/JoosepAlviste/nvim-ts-context-commentstring' }, { src = 'https://github.com/L3MON4D3/LuaSnip' }, - { src = 'https://github.com/rafamadriz/friendly-snippets' }, { src = 'https://github.com/MeanderingProgrammer/render-markdown.nvim' }, + { src = 'https://github.com/MeanderingProgrammer/render-markdown.nvim' }, + { src = 'https://github.com/MunifTanjim/nui.nvim' }, + { src = 'https://github.com/NeogitOrg/neogit' }, + { src = 'https://github.com/NicolasGB/jj.nvim' }, + { src = 'https://github.com/PhantomYdn/fabric-ai.nvim' }, + { src = 'https://github.com/Saecki/crates.nvim' }, { src = 'https://github.com/Saghen/blink.cmp', version = vim.version.range('1.*') }, - { src = 'https://github.com/cairijun/codecompanion-agentskills.nvim' }, - { src = 'https://github.com/fang2hou/blink-copilot' }, - { src = 'https://github.com/folke/todo-comments.nvim' }, - { src = 'https://github.com/franco-ruggeri/codecompanion-spinner.nvim' }, - { src = 'https://github.com/moyiz/blink-emoji.nvim' }, - { src = 'https://github.com/nvim-lua/plenary.nvim' }, - { src = 'https://github.com/ravitemer/codecompanion-history.nvim' }, - { src = 'https://github.com/ttgrules/cc-adapter-copilot-cli-acp' }, - { src = 'https://github.com/nvim-tree/nvim-web-devicons' }, { src = 'https://github.com/SjB/orgmode', version = 'sjb-wip' }, - { src = 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'main' }, - { src = 'https://github.com/nvim-treesitter/nvim-treesitter-textobjects', version = 'main' }, - { src = 'https://github.com/nvim-treesitter/nvim-treesitter-context' }, - { src = 'https://github.com/nvim-mini/mini.extra' }, + { src = 'https://github.com/SmiteshP/nvim-navic' }, + { src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim' }, + { src = 'https://github.com/akinsho/org-bullets.nvim' }, + { src = 'https://github.com/akinsho/toggleterm.nvim' }, + { src = 'https://github.com/al1-ce/just.nvim' }, + { src = 'https://github.com/cairijun/codecompanion-agentskills.nvim' }, + { src = 'https://github.com/cairijun/codecompanion-agentskills.nvim' }, + { src = 'https://github.com/carlos-algms/agentic.nvim' }, + { src = 'https://github.com/chipsenkbeil/org-roam.nvim' }, + { src = 'https://github.com/christoomey/vim-tmux-navigator' }, + { src = 'https://github.com/copilotlsp-nvim/copilot-lsp' }, + { src = 'https://github.com/esmuellert/codediff.nvim' }, + { src = 'https://github.com/fang2hou/blink-copilot' }, + { src = 'https://github.com/folke/flash.nvim' }, + { src = 'https://github.com/folke/persistence.nvim' }, + { src = 'https://github.com/folke/todo-comments.nvim' }, + { src = 'https://github.com/folke/which-key.nvim' }, + { src = 'https://github.com/franco-ruggeri/codecompanion-spinner.nvim' }, + { src = 'https://github.com/franco-ruggeri/codecompanion-spinner.nvim' }, + { src = 'https://github.com/hat0uma/csvview.nvim' }, + { src = 'https://github.com/hedyhli/outline.nvim' }, + { src = 'https://github.com/iamcco/markdown-preview.nvim' }, + { src = 'https://github.com/j-hui/fidget.nvim' }, + { src = 'https://github.com/jay-babu/mason-nvim-dap.nvim' }, + { src = 'https://github.com/julienvincent/hunk.nvim' }, + { src = 'https://github.com/lervag/vimtex' }, + { src = 'https://github.com/lewis6991/gitsigns.nvim' }, + { src = 'https://github.com/mbbill/undotree' }, + { src = 'https://github.com/mfussenegger/nvim-ansible' }, + { src = 'https://github.com/mfussenegger/nvim-dap' }, + { src = 'https://github.com/mistweaverco/kulala.nvim' }, + { src = 'https://github.com/moyiz/blink-emoji.nvim' }, + { src = 'https://github.com/neovim/nvim-lspconfig' }, + { src = 'https://github.com/nvim-lua/plenary.nvim' }, + { src = 'https://github.com/nvim-lualine/lualine.nvim' }, { src = 'https://github.com/nvim-mini/mini.ai' }, - { src = 'https://github.com/nvim-mini/mini.move' }, { src = 'https://github.com/nvim-mini/mini.align' }, { src = 'https://github.com/nvim-mini/mini.bracketed' }, - { src = 'https://github.com/nvim-mini/mini.operators' }, - { src = 'https://github.com/nvim-mini/mini.surround' }, - { src = 'https://github.com/nvim-mini/mini.splitjoin' }, - { src = 'https://github.com/nvim-mini/mini.hipatterns' }, + { src = 'https://github.com/nvim-mini/mini.extra' }, { src = 'https://github.com/nvim-mini/mini.files' }, + { src = 'https://github.com/nvim-mini/mini.hipatterns' }, + { src = 'https://github.com/nvim-mini/mini.move' }, + { src = 'https://github.com/nvim-mini/mini.operators' }, { src = 'https://github.com/nvim-mini/mini.sessions' }, - { src = 'https://github.com/mfussenegger/nvim-ansible' }, - { src = 'https://github.com/obsidian-nvim/obsidian.nvim' }, - { src = 'https://github.com/salkin-mada/openscad.nvim' }, - { src = 'https://github.com/akinsho/org-bullets.nvim' }, - { src = 'https://github.com/chipsenkbeil/org-roam.nvim' }, - { src = 'https://github.com/iamcco/markdown-preview.nvim' }, - { src = 'https://github.com/lervag/vimtex' }, - { src = 'https://github.com/MeanderingProgrammer/render-markdown.nvim' }, - { src = 'https://github.com/hat0uma/csvview.nvim' }, - { src = 'https://github.com/j-hui/fidget.nvim' }, - { src = 'https://github.com/utilyre/barbecue.nvim' }, - { src = 'https://github.com/SmiteshP/nvim-navic' }, - { src = 'https://github.com/folke/flash.nvim' }, - { src = 'https://github.com/nvim-lualine/lualine.nvim' }, - { src = 'https://github.com/hedyhli/outline.nvim' }, - { src = 'https://github.com/stevearc/quicker.nvim' }, - { src = 'https://github.com/christoomey/vim-tmux-navigator' }, - { src = 'https://github.com/akinsho/toggleterm.nvim' }, - { src = 'https://github.com/ten3roberts/window-picker.nvim' }, - { src = 'https://github.com/folke/which-key.nvim' }, - { src = 'https://github.com/al1-ce/just.nvim' }, - { src = 'https://github.com/mistweaverco/kulala.nvim' }, - { src = 'https://github.com/HakonHarnes/img-clip.nvim' }, - { src = 'https://github.com/uhs-robert/sshfs.nvim' }, - { src = 'https://github.com/esmuellert/codediff.nvim' }, - { src = 'https://plugins.ejri.dev/mise.nvim' }, - { src = 'https://github.com/NeogitOrg/neogit' }, - { src = 'https://github.com/thunder-coding/zincoxide' }, - { src = 'https://github.com/sindrets/diffview.nvim' }, - { src = 'https://github.com/MunifTanjim/nui.nvim' }, - { src = 'https://github.com/stevearc/conform.nvim' }, - { src = 'https://github.com/lewis6991/gitsigns.nvim' }, - { src = 'https://github.com/NicolasGB/jj.nvim' }, - { src = 'https://github.com/julienvincent/hunk.nvim' }, - { src = 'https://github.com/rafikdraoui/jj-diffconflicts' }, - { src = 'https://github.com/Glhou/jjsigns.nvim', version = 'fix/skip-extra-lines' }, - { src = 'https://github.com/williamboman/mason.nvim' }, - { src = 'https://github.com/williamboman/mason-lspconfig.nvim' }, - { src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim' }, - { src = 'https://github.com/neovim/nvim-lspconfig' }, - { src = 'https://github.com/rcarriga/nvim-dap-ui' }, - { src = 'https://github.com/mfussenegger/nvim-dap' }, + { src = 'https://github.com/nvim-mini/mini.splitjoin' }, + { src = 'https://github.com/nvim-mini/mini.surround' }, { src = 'https://github.com/nvim-neotest/nvim-nio' }, - { src = 'https://github.com/jay-babu/mason-nvim-dap.nvim' }, - { src = 'https://github.com/Saecki/crates.nvim' }, - { src = 'https://github.com/JoosepAlviste/nvim-ts-context-commentstring' }, - { src = 'https://github.com/nvim-treesitter/nvim-treesitter-context' }, - { src = 'https://github.com/mbbill/undotree' }, - { src = 'https://github.com/Civitasv/cmake-tools.nvim' }, - { src = 'https://github.com/folke/persistence.nvim' }, - { src = 'https://github.com/otavioschwanck/arrow.nvim' }, { src = 'https://github.com/nvim-pack/nvim-spectre' }, - { src = 'https://github.com/stevearc/overseer.nvim' }, - { src = 'https://github.com/Davidyz/VectorCode' }, - { src = 'https://github.com/franco-ruggeri/codecompanion-spinner.nvim' }, + { src = 'https://github.com/nvim-tree/nvim-web-devicons' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'main' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter-context' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter-context' }, + { src = 'https://github.com/nvim-treesitter/nvim-treesitter-textobjects', version = 'main' }, + { src = 'https://github.com/obsidian-nvim/obsidian.nvim' }, + { src = 'https://github.com/otavioschwanck/arrow.nvim' }, + { src = 'https://github.com/rafamadriz/friendly-snippets' }, + { src = 'https://github.com/rafikdraoui/jj-diffconflicts' }, { src = 'https://github.com/ravitemer/codecompanion-history.nvim' }, - { src = 'https://github.com/cairijun/codecompanion-agentskills.nvim' }, + { src = 'https://github.com/ravitemer/codecompanion-history.nvim' }, + { src = 'https://github.com/rcarriga/nvim-dap-ui' }, + { src = 'https://github.com/salkin-mada/openscad.nvim' }, + { src = 'https://github.com/sindrets/diffview.nvim' }, + { src = 'https://github.com/stevearc/conform.nvim' }, + { src = 'https://github.com/stevearc/overseer.nvim' }, + { src = 'https://github.com/stevearc/quicker.nvim' }, + { src = 'https://github.com/ten3roberts/window-picker.nvim' }, + { src = 'https://github.com/thunder-coding/zincoxide' }, { src = 'https://github.com/ttgrules/cc-adapter-copilot-cli-acp' }, - { src = 'https://github.com/carlos-algms/agentic.nvim' }, + { src = 'https://github.com/ttgrules/cc-adapter-copilot-cli-acp' }, + { src = 'https://github.com/uhs-robert/sshfs.nvim' }, + { src = 'https://github.com/utilyre/barbecue.nvim' }, + { src = 'https://github.com/williamboman/mason-lspconfig.nvim' }, + { src = 'https://github.com/williamboman/mason.nvim' }, { src = 'https://github.com/zbirenbaum/copilot.lua' }, - { src = 'https://github.com/copilotlsp-nvim/copilot-lsp' }, - { src = 'https://github.com/PhantomYdn/fabric-ai.nvim' }, + { src = 'https://plugins.ejri.dev/mise.nvim' }, }) diff --git a/config/nvim/plugin/agentic.lua b/config/nvim/plugin/agentic.lua index 7e0f4b1..29763e4 100644 --- a/config/nvim/plugin/agentic.lua +++ b/config/nvim/plugin/agentic.lua @@ -11,8 +11,8 @@ require('agentic').setup({ mode = { "i", "n", "v" }, -- Specify modes for this keybinding }, }, - switch_provider = "ras", -- Switch ACP provider - switch_model = "ram", -- Switch model + switch_provider = "ga", -- Switch ACP provider + switch_model = "gm", -- Switch model }, -- Keybindings for the prompt buffer only @@ -46,10 +46,10 @@ require('agentic').setup({ }) -vim.keymap.set({ "n", "v", "i" }, 'rat', function() require("agentic").toggle() end, { desc = "Toggle Agentic Chat" }) +vim.keymap.set({ "n", "v", "i" }, 'mat', function() require("agentic").toggle() end, { desc = "Toggle Agentic Chat" }) vim.keymap.set({ "n", "v" }, '', function() require("agentic").add_selection_or_file_to_context() end, { desc = "Add file or selection to Agentic to Context" }) -vim.keymap.set({ "n", "v", "i" }, 'ran', function() require("agentic").new_session() end, { desc = "New Agentic Session" }) +vim.keymap.set({ "n", "v", "i" }, 'man', function() require("agentic").new_session() end, { desc = "New Agentic Session" }) vim.keymap.set({ "n", "v", "i" }, 'r', function() require("agentic").restore_session() end, { desc = "Agentic Restore session" }) -vim.keymap.set({ "n" }, 'rad', function() require("agentic").add_current_line_diagnostics() end, { desc = "Add current line diagnostic to Agentic" }) -vim.keymap.set({ "n" }, 'raD', function() require("agentic").add_buffer_diagnostics() end, { desc = "Add all buffer diagnostics to Agentic" }) +vim.keymap.set({ "n" }, 'mad', function() require("agentic").add_current_line_diagnostics() end, { desc = "Add current line diagnostic to Agentic" }) +vim.keymap.set({ "n" }, 'maD', function() require("agentic").add_buffer_diagnostics() end, { desc = "Add all buffer diagnostics to Agentic" }) diff --git a/config/nvim/plugin/codecompanion.lua b/config/nvim/plugin/codecompanion.lua index d9a1936..78199de 100644 --- a/config/nvim/plugin/codecompanion.lua +++ b/config/nvim/plugin/codecompanion.lua @@ -1,14 +1,14 @@ -vim.keymap.set({'n', 'v'}, 'rct', 'CodeCompanionChat Toggle', { noremap = true, silent = true, desc = "CC Toggle" }) -vim.keymap.set({ 'n', 'v' }, 'rca', 'CodeCompanionActions', { noremap = true, silent = true, desc = "CC Action" }) -vim.keymap.set({ 'n' }, 'rce', 'CodeCompanion Explain', { desc = "CC Explain" }) -vim.keymap.set({ 'n' }, 'rcf', 'CodeCompanion Fix code', { desc = "CC fix" }) -vim.keymap.set({ 'v' }, 'rcc', 'CodeCompanionChat Add', { noremap = true, silent = true, desc = "CC Add" }) -vim.keymap.set({ 'v' }, 'rcr', 'CodeCompanion Code Review', { desc = 'Code Review' }) -vim.keymap.set({ 'v' }, 'rco', 'CodeCompanion Optimize Performance', { desc = 'Optimize Code' }) -vim.keymap.set({ 'v' }, 'rce', 'CodeCompanion Explain Code', { desc = 'Explain Code' }) -vim.keymap.set({ 'v' }, 'rcg', 'CodeCompanion Generate Tests', { desc = 'Generate Tests' }) -vim.keymap.set({ 'v' }, 'rcd', 'CodeCompanion Debug Analysis', { desc = 'Debug Analysis' }) +vim.keymap.set({'n', 'v'}, 'mct', 'CodeCompanionChat Toggle', { noremap = true, silent = true, desc = "CC Toggle" }) +vim.keymap.set({'n', 'v'}, 'mca', 'CodeCompanionActions', { noremap = true, silent = true, desc = "CC Action" }) +vim.keymap.set({'n'}, 'mce', 'CodeCompanion Explain', { desc = "CC Explain" }) +vim.keymap.set({'n'}, 'mcf', 'CodeCompanion Fix code', { desc = "CC fix" }) +vim.keymap.set({'v'}, 'mcc', 'CodeCompanionChat Add', { noremap = true, silent = true, desc = "CC Add" }) +vim.keymap.set({'v'}, 'mcr', 'CodeCompanion Code Review', { desc = 'Code Review' }) +vim.keymap.set({'v'}, 'mco', 'CodeCompanion Optimize Performance', { desc = 'Optimize Code' }) +vim.keymap.set({'v'}, 'mce', 'CodeCompanion Explain Code', { desc = 'Explain Code' }) +vim.keymap.set({'v'}, 'mcg', 'CodeCompanion Generate Tests', { desc = 'Generate Tests' }) +vim.keymap.set({'v'}, 'mcd', 'CodeCompanion Debug Analysis', { desc = 'Debug Analysis' }) -- TODO: run this command -- build = "uv tool upgrade vectorcode", -- This helps keeping the CLI up-to-date @@ -196,36 +196,36 @@ codecompanion.setup({ end, codex = function() return require("codecompanion.adapters").extend("codex", { - commands = { - default = { "codex-acp" }, - }, - schema = { - model = { - default = "github-copilot/gpt-5.2-codex", - }, - }, - defaults = { - timeout = 20000, - auth_method = "chatgpt", -- "openai-api-key"|"codex-api-key"|"chatgpt" - }, - }) - end, - opencode = function() - return require("codecompanion.adapters").extend("codex", { - commands = { - default = { "opencode", "acp" }, - }, - schema = { - model = { - default = "github-copilot/gpt-5.2-codex", - }, - }, + -- commands = { + -- default = { "codex-acp" }, + -- }, + -- schema = { + -- model = { + -- default = "github-copilot/gpt-5.2-codex", + -- }, + -- }, defaults = { timeout = 20000, auth_method = "chatgpt", -- "openai-api-key"|"codex-api-key"|"chatgpt" }, }) end, + -- opencode = function() + -- return require("codecompanion.adapters").extend("codex", { + -- commands = { + -- default = { "opencode", "acp" }, + -- }, + -- schema = { + -- model = { + -- default = "github-copilot/gpt-5.2-codex", + -- }, + -- }, + -- defaults = { + -- timeout = 20000, + -- auth_method = "chatgpt", -- "openai-api-key"|"codex-api-key"|"chatgpt" + -- }, + -- }) + -- end, }, }, rules = { @@ -265,10 +265,10 @@ codecompanion.setup({ save_chat_keymap = "ghs", picker = "snacks", dir_to_save = vim.env.HOME .. "/Documents/ai-history", - title_generation_opts = { - adapter = "copilot", - model = "gpt-5-mini", - }, + -- title_generation_opts = { + -- adapter = "copilot", + -- model = "gpt-5-mini", + -- }, summary = { create_summary_keymap = "ghc", browse_summaries_keymap = "ghb", @@ -298,20 +298,25 @@ codecompanion.setup({ }, tools = { opts = { - auto_submit_errors = true, -- Send any errors to the LLM automatically? - auto_submit_success = true, -- Send any successful output to the LLM automatically? + auto_submit_errors = false, -- Send any errors to the LLM automatically? + auto_submit_success = false, -- Send any successful output to the LLM automatically? system_prompt = { enabled = true, replace_main_system_prompt = false, }, default_tools = { + "ask_questions", "file_search", "read_file", "cmd_runner", + "fetch", + "grep_search", + "memory", -- "ddgr_search", }, }, ["fetch_enhanced"] = { + description = "Fetch a data from the web", callback = function(url, options) options = options or {} local max_length = options.max_length or 200000 -- 200KB default @@ -413,6 +418,7 @@ codecompanion.setup({ description = "Planning my project and codes with enhanced web access", prompt = "Using all the ${tools} at your disposal including enhanced web fetching. Analyze the codes and use it to help me with my query. You have access to unlimited web content fetching.", tools = { + "ask_questions", "fetch", -- Backup unlimited fetch "file_search", "grep_search", @@ -436,6 +442,7 @@ codecompanion.setup({ description = "Deep research with unlimited web access", prompt = "You are a research assistant with unlimited web access. Using the ${tools} fetch and analyze large documents, research papers, and comprehensive web content.", tools = { + "ask_questions", "fetch", "fetch_enhanced", "file_search", @@ -450,14 +457,7 @@ codecompanion.setup({ description = "Full-stack development with all necessary tools", prompt = "You are an expert full-stack developer. Use ${tools} to understand, modify, and test code. Always gather context before making changes.", tools = { - "file_search", - "grep_search", - "fetch", - "list_code_usages", - "read_file", - "insert_edit_into_file", - "cmd_runner", - "next_edit_suggestion", + "agents", }, opts = { collapse_tools = true, @@ -619,7 +619,7 @@ codecompanion.setup({ role = "user", content = function(context) local code = require("codecompanion.helpers.actions").get_code(context.start_line, context.end_line) - return fmt( + return string.format( [[Help me debug this code from buffer %d and identify potential issues: ```%s @@ -635,7 +635,7 @@ codecompanion.setup({ } }, }, - cc_keyword = { "bug", "debug", "error", "exception", "crash", "stacktrace", "broken", "issue" }, + cc_keywords = { "bug", "debug", "error", "exception", "crash", "stacktrace", "broken", "issue" }, }, ["Architecture Review"] = { interaction = "chat", diff --git a/config/nvim/plugin/git.lua b/config/nvim/plugin/git.lua index d2f3a79..c3270a3 100644 --- a/config/nvim/plugin/git.lua +++ b/config/nvim/plugin/git.lua @@ -1,5 +1,5 @@ -vim.keymap.set({ 'n' }, 'uG', "Gitsigns toggle_signs", { desc = 'Gitsigns toggle' }) +vim.keymap.set({ 'n' }, 'ug', "Gitsigns toggle_signs", { desc = 'Gitsigns toggle' }) require('gitsigns').setup({ auto_attach = true, @@ -31,15 +31,15 @@ require('gitsigns').setup({ map('n', '[v', function() gitsigns.nav_hunk 'prev' end, { desc = 'git previous hunk' }) map('n', ']v', function() gitsigns.nav_hunk 'next' end, { desc = 'git next hunk' }) - map('n', 'vs', gitsigns.stage_hunk, { desc = 'git stage hunk' }) - map('n', 'vr', gitsigns.reset_hunk, { desc = 'git reset hunk' }) - map('n', 'vS', gitsigns.stage_buffer, { desc = 'git stage buffer' }) - map('n', 'vu', gitsigns.undo_stage_hunk, { desc = 'git undo stage hunk' }) - map('n', 'vR', gitsigns.reset_buffer, { desc = 'git reset buffer' }) - map('n', 'vP', gitsigns.preview_hunk, { desc = 'git preview hunk' }) - map('n', 'vb', gitsigns.blame_line, { desc = 'git blame line' }) - map('n', 'vP', gitsigns.diffthis, { desc = 'git diff against index' }) - map('n', 'vD', function() + map('n', 'vgs', gitsigns.stage_hunk, { desc = 'git stage hunk' }) + map('n', 'vgr', gitsigns.reset_hunk, { desc = 'git reset hunk' }) + map('n', 'vgS', gitsigns.stage_buffer, { desc = 'git stage buffer' }) + map('n', 'vgu', gitsigns.undo_stage_hunk, { desc = 'git undo stage hunk' }) + map('n', 'vgR', gitsigns.reset_buffer, { desc = 'git reset buffer' }) + map('n', 'vgP', gitsigns.preview_hunk, { desc = 'git preview hunk' }) + map('n', 'vgb', gitsigns.blame_line, { desc = 'git blame line' }) + map('n', 'vgP', gitsigns.diffthis, { desc = 'git diff against index' }) + map('n', 'vgD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) -- Toggles diff --git a/config/nvim/plugin/jj.lua b/config/nvim/plugin/jj.lua index 578adea..657c515 100644 --- a/config/nvim/plugin/jj.lua +++ b/config/nvim/plugin/jj.lua @@ -2,33 +2,33 @@ local cmd = require("jj.cmd") local annotate = require("jj.annotate") -vim.keymap.set("n", "va", annotate.file, { desc = "JJ annotate file" }) -vim.keymap.set("n", "vA", annotate.line, { desc = "JJ annotate line" }) -vim.keymap.set("n", "vbc", cmd.bookmark_create, { desc = "JJ bookmark create" }) -vim.keymap.set("n", "vbd", cmd.bookmark_delete, { desc = "JJ bookmark delete" }) -vim.keymap.set("n", "vbm", cmd.bookmark_move, { desc = "JJ bookmark move" }) -vim.keymap.set("n", "vd", cmd.describe, { desc = "JJ describe" }) -vim.keymap.set("n", "vl", cmd.log, { desc = "JJ log" }) -vim.keymap.set("n", "ve", cmd.edit, { desc = "JJ edit" }) -vim.keymap.set("n", "vn", cmd.new, { desc = "JJ new" }) -vim.keymap.set("n", "vs", cmd.status, { desc = "JJ status" }) -vim.keymap.set("n", "vS", cmd.squash, { desc = "JJ squash" }) -vim.keymap.set("n", "vju", cmd.undo, { desc = "JJ undo" }) -vim.keymap.set("n", "vjr", cmd.redo, { desc = "JJ redo" }) -vim.keymap.set("n", "vr", cmd.rebase, { desc = "JJ rebase" }) -vim.keymap.set("n", "vf", cmd.fetch, { desc = "JJ fetch" }) -vim.keymap.set("n", "vx", cmd.abandon, { desc = "JJ abandon" }) -vim.keymap.set("n", "vp", cmd.push, { desc = "JJ push" }) -vim.keymap.set("n", "vpr", cmd.open_pr, { desc = "JJ open PR from bookmark in current revision or parent" }) -vim.keymap.set("n", "vpl", function() +vim.keymap.set("n", "vja", annotate.file, { desc = "JJ annotate file" }) +vim.keymap.set("n", "vjA", annotate.line, { desc = "JJ annotate line" }) +vim.keymap.set("n", "vjbc", cmd.bookmark_create, { desc = "JJ bookmark create" }) +vim.keymap.set("n", "vjbd", cmd.bookmark_delete, { desc = "JJ bookmark delete" }) +vim.keymap.set("n", "vjbm", cmd.bookmark_move, { desc = "JJ bookmark move" }) +vim.keymap.set("n", "vjd", cmd.describe, { desc = "JJ describe" }) +vim.keymap.set("n", "vjl", cmd.log, { desc = "JJ log" }) +vim.keymap.set("n", "vje", cmd.edit, { desc = "JJ edit" }) +vim.keymap.set("n", "vjn", cmd.new, { desc = "JJ new" }) +--vim.keymap.set("n", "vjs", cmd.status, { desc = "JJ status" }) +vim.keymap.set("n", "vjS", cmd.squash, { desc = "JJ squash" }) +vim.keymap.set("n", "vjju", cmd.undo, { desc = "JJ undo" }) +vim.keymap.set("n", "vjr", cmd.rebase, { desc = "JJ rebase" }) +vim.keymap.set("n", "vjR", cmd.redo, { desc = "JJ redo" }) +vim.keymap.set("n", "vjf", cmd.fetch, { desc = "JJ fetch" }) +vim.keymap.set("n", "vjx", cmd.abandon, { desc = "JJ abandon" }) +vim.keymap.set("n", "vjpp", cmd.push, { desc = "JJ push" }) +vim.keymap.set("n", "vjpr", cmd.open_pr, { desc = "JJ open PR from bookmark in current revision or parent" }) +vim.keymap.set("n", "vjpl", function() cmd.open_pr { list_bookmarks = true } end, { desc = "JJ open PR listing available bookmarks" }) -- Diff commands local diff = require("jj.diff") -vim.keymap.set("n", "vjd", function() diff.open_vdiff() end, { desc = "JJ diff current buffer" }) -vim.keymap.set("n", "vjD", function() diff.open_hsplit() end, { desc = "JJ hdiff current buffer" }) +vim.keymap.set("n", "vjdv", function() diff.open_vdiff() end, { desc = "JJ diff current buffer" }) +vim.keymap.set("n", "vjdh", function() diff.open_hsplit() end, { desc = "JJ hdiff current buffer" }) -- Pickers local picker = require("jj.picker") @@ -36,7 +36,7 @@ vim.keymap.set("n", "vjs", function() picker.status() end, { desc = "JJ vim.keymap.set("n", "vjh", function() picker.file_history() end, { desc = "JJ Picker history" }) -- Some functions like `log` can take parameters -vim.keymap.set("n", "vL", function() +vim.keymap.set("n", "vjL", function() cmd.log { revisions = "all()", -- equivalent to jj log -r :: } @@ -44,7 +44,7 @@ end, { desc = "JJ log all" }) -- This is an alias i use for moving bookmarks its so good -vim.keymap.set("n", "vt", function() +vim.keymap.set("n", "vjt", function() cmd.j "tug" cmd.log {} end, { desc = "JJ tug" }) @@ -74,3 +74,5 @@ require('jjsigns').setup({ auto = false, } }) + +vim.keymap.set("n", "uJ", function() require('jjsigns').toggle() end, { desc = "Toggle JJ signs" }) diff --git a/config/nvim/plugin/lsp.lua b/config/nvim/plugin/lsp.lua index 2a85f57..4b23ab9 100644 --- a/config/nvim/plugin/lsp.lua +++ b/config/nvim/plugin/lsp.lua @@ -164,7 +164,18 @@ local servers = { -- }, -- }, -- }, - }, + }, + omnisharp = { + settings = { + ["omnisharp"] = { + useModernNet = true, + organizeImportsOnFormat = true, + enableImportCompletion = true, + cmd = { "omnisharp" }, + root_dir = require("lspconfig.util").root_pattern("*.sln", "*.csproj", ".git"), + } + } + }, } local ensure_installed = vim.tbl_keys(servers or {}) diff --git a/config/nvim/plugin/mini.lua b/config/nvim/plugin/mini.lua index 6c7a477..617d13c 100644 --- a/config/nvim/plugin/mini.lua +++ b/config/nvim/plugin/mini.lua @@ -64,14 +64,10 @@ require('mini.hipatterns').setup({ }, }) -vim.keymap.set('n', "-", function() require("mini.files").open(vim.api.nvim_buf_get_name(0)) end, { desc = "Open parent directory" }) -vim.keymap.set('n', "-", function() require("mini.files").open() end, { desc = "File Explore" }) +vim.keymap.set('n', "q", function() require("mini.files").open(vim.api.nvim_buf_get_name(0)) end, { desc = "Open parent directory" }) +vim.keymap.set('n', "Q", function() require("mini.files").open() end, { desc = "File Explore" }) require('mini.files').setup({ mappings = { - go_in = "", -- Map both Enter and L to enter directories or open files - go_in_plus = "L", - go_out = "-", - go_out_plus = "H", close = "", }, }) diff --git a/config/nvim/plugin/nvim-ansible.lua b/config/nvim/plugin/nvim-ansible.lua index 7beb162..4f50bd0 100644 --- a/config/nvim/plugin/nvim-ansible.lua +++ b/config/nvim/plugin/nvim-ansible.lua @@ -1,2 +1,2 @@ -vim.keymap.set('v', 'te', function() require('ansible').run() end, { buffer = true, silent = true }) -vim.keymap.set('n', 'te', ":w :lua require('ansible').run()", { buffer = true, silent = true }) +vim.keymap.set('v', 'xa', function() require('ansible').run() end, { buffer = true, silent = true, desc = 'execute via ansible' }) +vim.keymap.set('n', 'xa', ":w :lua require('ansible').run()", { buffer = true, silent = true, desc = 'execute via ansible' }) diff --git a/config/nvim/plugin/snacks.lua b/config/nvim/plugin/snacks.lua index eb5a19c..bbe77d9 100644 --- a/config/nvim/plugin/snacks.lua +++ b/config/nvim/plugin/snacks.lua @@ -41,22 +41,22 @@ require('snacks').setup({ end) end end, - term_normal = { - "", - function(self) - self.esc_timer = self.esc_timer or (vim.uv or vim.loop).new_timer() - if self.esc_timer:is_active() then - self.esc_timer:stop() - vim.cmd("stopinsert") - else - self.esc_timer:start(250, 0, function() end) - return "" - end - end, - mode = "t", - expr = true, - desc = "Double escape to normal mode", - }, + -- term_normal = { + -- "", + -- function(self) + -- self.esc_timer = self.esc_timer or (vim.uv or vim.loop).new_timer() + -- if self.esc_timer:is_active() then + -- self.esc_timer:stop() + -- vim.cmd("stopinsert") + -- else + -- self.esc_timer:start(250, 0, function() end) + -- return "" + -- end + -- end, + -- mode = "t", + -- expr = true, + -- desc = "Double escape to normal mode", + -- }, }, }, indent = { enabled = false }, @@ -207,7 +207,7 @@ vim.keymap.set('n', "sk", function() Snacks.picker.keymaps() end, { desc vim.keymap.set('n', "sl", function() Snacks.picker.loclist() end, { desc = "Location List" }) vim.keymap.set('n', "sm", function() Snacks.picker.marks() end, { desc = "Marks" }) vim.keymap.set('n', "sM", function() Snacks.picker.man() end, { desc = "Man Pages" }) -vim.keymap.set('n', "sp", function() Snacks.picker.lazy() end, { desc = "Search for Plugin Spec" }) +-- vim.keymap.set('n', "sp", function() Snacks.picker.lazy() end, { desc = "Search for Plugin Spec" }) vim.keymap.set('n', "sq", function() Snacks.picker.qflist() end, { desc = "Quickfix List" }) vim.keymap.set('n', "sR", function() Snacks.picker.resume() end, { desc = "Resume" }) vim.keymap.set('n', "su", function() Snacks.picker.undo() end, { desc = "Undo History" }) @@ -253,7 +253,6 @@ end, { desc = "Neovim News" }) vim.api.nvim_create_autocmd("User", { - pattern = "VeryLazy", callback = function() -- Setup some globals for debugging (lazy-loaded) _G.dd = function(...) diff --git a/config/nvim/plugin/toggleterm.lua b/config/nvim/plugin/toggleterm.lua index a975d06..4311c89 100644 --- a/config/nvim/plugin/toggleterm.lua +++ b/config/nvim/plugin/toggleterm.lua @@ -1,13 +1,14 @@ require("toggleterm").setup({ -- highlights = require("rose-pine.plugins.toggleterm"), size = 20, - open_mapping = [[]], + open_mapping = [[]], hide_numbers = true, shade_terminals = true, shading_factor = 2, start_in_insert = true, insert_mappings = true, persiste_size = true, + shell = vim.env.SHELL, direction = 'horizontal', close_on_exit = true, float_opts = { @@ -15,4 +16,4 @@ require("toggleterm").setup({ } }) -vim.keymap.set('t', "", "", { desc = "Escape input" }) +vim.keymap.set('t', "", "", { desc = "Escape input" }) diff --git a/config/nvim/plugin/tools.lua b/config/nvim/plugin/tools.lua index 6782cbc..2e196e1 100644 --- a/config/nvim/plugin/tools.lua +++ b/config/nvim/plugin/tools.lua @@ -1,9 +1,3 @@ -vim.keymap.set({'n'}, 'gn', 'Neogit kind=auto', { desc = 'Neogit' }) -vim.keymap.set({'n'}, 'gN', 'Neogit kind=floating', { desc = 'Neogit' }) -vim.keymap.set({'n'}, 'xm', 'Lazy reload mise.nvim', { desc = "Reload mise environment" }) -vim.keymap.set({'n'}, 'kp', 'PasteImage', { desc = "Paste image from system clipboard" }) -vim.keymap.set({ 'n' }, 'uu', vim.cmd.UndotreeToggle, { desc = 'Format buffer' }) - require('kulala').setup() require("just").setup({ @@ -20,9 +14,11 @@ require('sshfs').setup({ mounts = { base_dir = vim.fn.expand("$HOME") .. "/Public", -- where remote mounts are created }, + lead_prefix = "r", -- Refer to the configuration section below -- or leave empty for defaults }) + require('mise').setup({ unset_vars = true, load_on_setup = true, @@ -45,18 +41,19 @@ require('neogit').setup({ recent = { folded = false }, }, }) + require('zincoxide').setup({ zincoxide_cmd = "zoxide", complete = true, behaviour = "tabs", }) - - -vim.keymap.set('n', "xo", "OverseerOpen", { desc = "Open Overseer" }) -vim.keymap.set('n', "to", "OverseerToggle", { desc = "Overseer Toggle" }) -vim.keymap.set('n', "", "OverseerRun", { desc = "Run Overseer" }) -vim.keymap.set('n', "", "OverseerToggle", { desc = "Overseer Toggle" }) +require('trouble').setup({ + defaults = { + auto_close = true, + auto_open = true, + }, +}) require("overseer").setup({ templates = { "builtin", "user" }, @@ -65,14 +62,14 @@ require("overseer").setup({ { 'display_duration', detail_level = 2 }, 'on_output_summarize', 'on_exit_set_status', - 'on_result_diagnostics_quickfix', 'on_complete_notify', - { "on_complete_dispose", require_view = { "SUCCESS", "FAILURE" } }, + 'on_result_diagnostics', + {'on_result_diagnostics_quickfix', open = true, close = true}, }, default_vscode = { 'default', 'on_result_diagnostics', - 'on_result_diagnostics_quickfix', + {'on_result_diagnostics_quickfix', open = true, close = true}, 'on_complete_notify', }, } @@ -232,3 +229,22 @@ require("cmake-tools").setup { }, cmake_virtual_text_support = true, -- Show the target related to current file using virtual text (at right corner) } + +vim.keymap.set({'n'}, 'vn', 'Neogit kind=auto', { desc = 'Neogit' }) +vim.keymap.set({'n'}, 'vN', 'Neogit kind=floating', { desc = 'Neogit' }) + +vim.keymap.set({'n'}, 'kp', 'PasteImage', { desc = "Paste image from system clipboard" }) +vim.keymap.set({'n'}, 'xM', 'Lazy reload mise.nvim', { desc = "Reload mise environment" }) +vim.keymap.set({'n'}, 'uu', vim.cmd.UndotreeToggle, { desc = 'Undo Tree toggle' }) + +vim.keymap.set('n', "cx", "Trouble diagnostics toggle", { desc = "Diagnostics (Trouble)" }) +vim.keymap.set('n', "cX", "Trouble diagnostics toggle filter.buf=0", { desc = "Buffer Diagnostics (Trouble)" }) +vim.keymap.set('n', "cs", "Trouble symbols toggle focus=false", { desc = "Symbols (Trouble)" }) +vim.keymap.set('n', "cl", "Trouble lsp toggle focus=false win.position=right", { desc = "LSP Definitions / references / ... (Trouble)" }) +vim.keymap.set('n', "cL", "Trouble loclist toggle", { desc = "Location List (Trouble)" }) +vim.keymap.set('n', "cQ", "Trouble qflist toggle", { desc = "Quickfix List (Trouble)" }) + +vim.keymap.set('n', "uo", "OverseerToggle", { desc = "Overseer Toggle" }) +vim.keymap.set('n', "", "OverseerRun", { desc = "Run Overseer" }) +vim.keymap.set('n', "", "OverseerToggle", { desc = "Overseer Toggle" }) + diff --git a/config/nvim/plugin/which-key.lua b/config/nvim/plugin/which-key.lua index 0fc51f7..94a6089 100644 --- a/config/nvim/plugin/which-key.lua +++ b/config/nvim/plugin/which-key.lua @@ -45,9 +45,9 @@ require('which-key').setup({ { "g", group = "+goto" }, { "k", group = "+obsidian" }, { "l", group = "+lsp" }, - { "m", group = "+bookmark" }, + { "m", group = "+ai" }, { "o", group = "+notes" }, - { "r", group = "+ai" }, + { "r", group = "+remote" }, { "s", group = "+search" }, { "t", group = "+trouble" }, { "v", group = "+vcs", mode = { 'n', 'v' } },