diff options
Diffstat (limited to 'lua/plugins')
| -rw-r--r-- | lua/plugins/CodeGPT.lua | 10 | ||||
| -rw-r--r-- | lua/plugins/aerial.lua | 54 | ||||
| -rw-r--r-- | lua/plugins/close-buffer.lua | 12 | ||||
| -rw-r--r-- | lua/plugins/code-annotation.lua | 35 | ||||
| -rw-r--r-- | lua/plugins/codecompanion.lua | 15 | ||||
| -rw-r--r-- | lua/plugins/copilot-chat.lua | 219 | ||||
| -rw-r--r-- | lua/plugins/flutter.lua | 2 | ||||
| -rw-r--r-- | lua/plugins/hurl.lua | 39 | ||||
| -rw-r--r-- | lua/plugins/icon-picker.lua | 2 | ||||
| -rw-r--r-- | lua/plugins/lsp.lua | 3 | ||||
| -rw-r--r-- | lua/plugins/navigator.lua | 43 | ||||
| -rw-r--r-- | lua/plugins/neotest.lua | 6 | ||||
| -rw-r--r-- | lua/plugins/note.lua | 29 | ||||
| -rw-r--r-- | lua/plugins/nvim-ts-autotag.lua | 7 | ||||
| -rw-r--r-- | lua/plugins/rayso.lua | 10 | ||||
| -rw-r--r-- | lua/plugins/spectre.lua | 70 | ||||
| -rw-r--r-- | lua/plugins/undotree.lua | 40 | ||||
| -rw-r--r-- | lua/plugins/which-key.lua | 12 | ||||
| -rw-r--r-- | lua/plugins/zenmode.lua | 44 |
19 files changed, 621 insertions, 31 deletions
diff --git a/lua/plugins/CodeGPT.lua b/lua/plugins/CodeGPT.lua deleted file mode 100644 index ee3579b..0000000 --- a/lua/plugins/CodeGPT.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "dpayne/CodeGPT.nvim", - dependencies = { - 'nvim-lua/plenary.nvim', - 'MunifTanjim/nui.nvim', - }, - config = function() - require("codegpt.config") - end -} diff --git a/lua/plugins/aerial.lua b/lua/plugins/aerial.lua new file mode 100644 index 0000000..f8bc139 --- /dev/null +++ b/lua/plugins/aerial.lua @@ -0,0 +1,54 @@ +-- Silent keymap option +local opts = { silent = true } + +return { + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + opts.right = opts.right or {} + table.insert(opts.right, "aerial") + table.insert(opts.right, { + title = "hurl.nvim", + ft = "hurl-nvim", + size = { width = 0.5 }, + }) + + end, + }, + { + "stevearc/aerial.nvim", + keys = { + { "<leader>ta", "<cmd>AerialToggle<cr>", desc = "AerialToggle" }, + }, + config = function() + local status_ok, aerial = pcall(require, "aerial") + if not status_ok then + return + end + + aerial.setup({ + -- optionally use on_attach to set keymaps when aerial has attached to a buffer + on_attach = function(bufnr) + -- Jump forwards/backwards with '{' and '}' + vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr }) + vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr }) + + vim.keymap.set("n", "<leader>fi", "<cmd>Telescope aerial<CR>", opts) + end, + }) + + local tele_status_ok, telescope = pcall(require, "telescope") + if not tele_status_ok then + return + end + + -- Define a custom command to open aerial with telescope + vim.keymap.set("n", "<leader>fi", "<cmd>Telescope aerial<CR>", { + desc = "Telescope Aerial", + }) + + telescope.load_extension("aerial") + end, + }, +} diff --git a/lua/plugins/close-buffer.lua b/lua/plugins/close-buffer.lua new file mode 100644 index 0000000..947f31a --- /dev/null +++ b/lua/plugins/close-buffer.lua @@ -0,0 +1,12 @@ +return { + -- Send buffers into early retirement by automatically closing them after x minutes of inactivity. + { + "chrisgrieser/nvim-early-retirement", + config = true, + event = "VeryLazy", + opts = { + -- if a buffer has been inactive for this many minutes, close it + retirementAgeMins = 30, + }, + }, +} diff --git a/lua/plugins/code-annotation.lua b/lua/plugins/code-annotation.lua new file mode 100644 index 0000000..eae61d0 --- /dev/null +++ b/lua/plugins/code-annotation.lua @@ -0,0 +1,35 @@ +local neogeo_opts = {} + +if not vim.g.vscode then + neogeo_opts = { + enabled = true, + -- Only use luasnip as snippet engine if that is not vscode + snippet_engine = "luasnip", + } +end + +return { + -- JsDoc generator + { + "heavenshell/vim-jsdoc", + ft = "javascript,typescript,typescriptreact,svelte", + cmd = "JsDoc", + keys = { + { "<leader>jd", "<cmd>JsDoc<cr>", desc = "JsDoc" }, + }, + -- make sure that you will have lehre install locally on plugin folder, refer https://github.com/heavenshell/vim-jsdoc#manual-installation + build = "make install", + }, + { + -- A better annotation generator. Supports multiple languages and annotation conventions. + -- <C-n> to jump to next annotation, <C-p> to jump to previous annotation + "danymat/neogen", + vscode = true, + dependencies = "nvim-treesitter/nvim-treesitter", + opts = neogeo_opts, + cmd = "Neogen", + keys = { + { "<leader>ci", "<cmd>Neogen<cr>", desc = "Neogen - Annotation generator" }, + }, + }, +} diff --git a/lua/plugins/codecompanion.lua b/lua/plugins/codecompanion.lua new file mode 100644 index 0000000..a98a7af --- /dev/null +++ b/lua/plugins/codecompanion.lua @@ -0,0 +1,15 @@ +return { + "olimorris/codecompanion.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "hrsh7th/nvim-cmp", -- Optional: For using slash commands and variables in the chat buffer + "nvim-telescope/telescope.nvim", -- Optional: For using slash commands + { + "MeanderingProgrammer/render-markdown.nvim", + ft = { "markdown", "codecompanion" }, + }, -- Optional: For prettier markdown rendering + { "stevearc/dressing.nvim", opts = {} }, -- Optional: Improves `vim.ui.select` + }, + config = true, +} diff --git a/lua/plugins/copilot-chat.lua b/lua/plugins/copilot-chat.lua index 63ec0b2..0ae500d 100644 --- a/lua/plugins/copilot-chat.lua +++ b/lua/plugins/copilot-chat.lua @@ -1,15 +1,224 @@ +local IS_DEV = false + +local prompts = { + -- Code related prompts + Explain = "Please explain how the following code works.", + Review = "Please review the following code and provide suggestions for improvement.", + Tests = "Please explain how the selected code works, then generate unit tests for it.", + Refactor = "Please refactor the following code to improve its clarity and readability.", + FixCode = "Please fix the following code to make it work as intended.", + FixError = "Please explain the error in the following text and provide a solution.", + BetterNamings = "Please provide better names for the following variables and functions.", + Documentation = "Please provide documentation for the following code.", + SwaggerApiDocs = "Please provide documentation for the following API using Swagger.", + SwaggerJsDocs = "Please write JSDoc for the following API using Swagger.", + -- Text related prompts + Summarize = "Please summarize the following text.", + Spelling = "Please correct any grammar and spelling errors in the following text.", + Wording = "Please improve the grammar and wording of the following text.", + Concise = "Please rewrite the following text to make it more concise.", +} + return { + -- { import = "plugins.extras.copilot-vim" }, -- Or use { import = "lazyvim.plugins.extras.coding.copilot" }, + { + "folke/which-key.nvim", + optional = true, + opts = { + spec = { + { "<leader>a", group = "ai" }, + { "gm", group = "+Copilot chat" }, + { "gmh", desc = "Show help" }, + { "gmd", desc = "Show diff" }, + { "gmp", desc = "Show system prompt" }, + { "gms", desc = "Show selection" }, + { "gmy", desc = "Yank diff" }, + }, + }, + }, { + dir = IS_DEV and "~/Projects/research/CopilotChat.nvim" or nil, "CopilotC-Nvim/CopilotChat.nvim", - branch = "canary", + -- version = "v3.3.0", -- Use a specific version to prevent breaking changes dependencies = { + { "nvim-telescope/telescope.nvim" }, -- Use telescope for help actions + { "nvim-lua/plenary.nvim" }, { "zbirenbaum/copilot.lua" }, -- or github/copilot.vim - { "nvim-lua/plenary.nvim" }, -- for curl, log wrapper }, opts = { - debug = true, -- Enable debugging - -- See Configuration section for rest + question_header = "## User ", + answer_header = "## Copilot ", + error_header = "## Error ", + prompts = prompts, + auto_follow_cursor = false, -- Don't follow the cursor after getting response + mappings = { + -- Use tab for completion + complete = { + detail = "Use @<Tab> or /<Tab> for options.", + insert = "<Tab>", + }, + -- Close the chat + close = { + normal = "q", + insert = "<C-c>", + }, + -- Reset the chat buffer + reset = { + normal = "<C-x>", + insert = "<C-x>", + }, + -- Submit the prompt to Copilot + submit_prompt = { + normal = "<CR>", + insert = "<C-CR>", + }, + -- Accept the diff + accept_diff = { + normal = "<C-y>", + insert = "<C-y>", + }, + -- Yank the diff in the response to register + yank_diff = { + normal = "gmy", + }, + -- Show the diff + show_diff = { + normal = "gmd", + }, + -- Show the info + show_info = { + normal = "gmi", + }, + -- Show the context + show_context = { + normal = "gmc", + }, + -- Show help + show_help = { + normal = "gmh", + }, + }, + }, + config = function(_, opts) + local chat = require("CopilotChat") + local select = require("CopilotChat.select") + -- Use unnamed register for the selection + opts.selection = select.unnamed + + chat.setup(opts) + + vim.api.nvim_create_user_command("CopilotChatVisual", function(args) + chat.ask(args.args, { selection = select.visual }) + end, { nargs = "*", range = true }) + + -- Inline chat with Copilot + vim.api.nvim_create_user_command("CopilotChatInline", function(args) + chat.ask(args.args, { + selection = select.visual, + window = { + layout = "float", + relative = "cursor", + width = 1, + height = 0.4, + row = 1, + }, + }) + end, { nargs = "*", range = true }) + + -- Restore CopilotChatBuffer + vim.api.nvim_create_user_command("CopilotChatBuffer", function(args) + chat.ask(args.args, { selection = select.buffer }) + end, { nargs = "*", range = true }) + + -- Custom buffer for CopilotChat + vim.api.nvim_create_autocmd("BufEnter", { + pattern = "copilot-*", + callback = function() + vim.opt_local.relativenumber = true + vim.opt_local.number = true + + -- Get current filetype and set it to markdown if the current filetype is copilot-chat + local ft = vim.bo.filetype + if ft == "copilot-chat" then + vim.bo.filetype = "markdown" + end + end, + }) + end, + event = "VeryLazy", + keys = { + -- Show prompts actions with telescope + { + "<leader>ap", + function() + local actions = require("CopilotChat.actions") + require("CopilotChat.integrations.telescope").pick(actions.prompt_actions()) + end, + desc = "CopilotChat - Prompt actions", + }, + { + "<leader>ap", + ":lua require('CopilotChat.integrations.telescope').pick(require('CopilotChat.actions').prompt_actions({selection = require('CopilotChat.select').visual}))<CR>", + mode = "x", + desc = "CopilotChat - Prompt actions", + }, + -- Code related commands + { "<leader>ae", "<cmd>CopilotChatExplain<cr>", desc = "CopilotChat - Explain code" }, + { "<leader>at", "<cmd>CopilotChatTests<cr>", desc = "CopilotChat - Generate tests" }, + { "<leader>ar", "<cmd>CopilotChatReview<cr>", desc = "CopilotChat - Review code" }, + { "<leader>aR", "<cmd>CopilotChatRefactor<cr>", desc = "CopilotChat - Refactor code" }, + { "<leader>an", "<cmd>CopilotChatBetterNamings<cr>", desc = "CopilotChat - Better Naming" }, + -- Chat with Copilot in visual mode + { + "<leader>av", + ":CopilotChatVisual", + mode = "x", + desc = "CopilotChat - Open in vertical split", + }, + { + "<leader>ax", + ":CopilotChatInline<cr>", + mode = "x", + desc = "CopilotChat - Inline chat", + }, + -- Custom input for CopilotChat + { + "<leader>ai", + function() + local input = vim.fn.input("Ask Copilot: ") + if input ~= "" then + vim.cmd("CopilotChat " .. input) + end + end, + desc = "CopilotChat - Ask input", + }, + -- Generate commit message based on the git diff + { + "<leader>am", + "<cmd>CopilotChatCommit<cr>", + desc = "CopilotChat - Generate commit message for all changes", + }, + -- Quick chat with Copilot + { + "<leader>aq", + function() + local input = vim.fn.input("Quick Chat: ") + if input ~= "" then + vim.cmd("CopilotChatBuffer " .. input) + end + end, + desc = "CopilotChat - Quick chat", + }, + -- Debug + { "<leader>ad", "<cmd>CopilotChatDebugInfo<cr>", desc = "CopilotChat - Debug Info" }, + -- Fix the issue with diagnostic + { "<leader>af", "<cmd>CopilotChatFixDiagnostic<cr>", desc = "CopilotChat - Fix Diagnostic" }, + -- Clear buffer and chat history + { "<leader>al", "<cmd>CopilotChatReset<cr>", desc = "CopilotChat - Clear buffer and chat history" }, + -- Toggle Copilot Chat Vsplit + { "<leader>av", "<cmd>CopilotChatToggle<cr>", desc = "CopilotChat - Toggle" }, + -- Copilot Chat Models + { "<leader>a?", "<cmd>CopilotChatModels<cr>", desc = "CopilotChat - Select Models" }, }, - -- See Commands section for default commands if you want to lazy load on them }, } diff --git a/lua/plugins/flutter.lua b/lua/plugins/flutter.lua index 91cabad..9d83940 100644 --- a/lua/plugins/flutter.lua +++ b/lua/plugins/flutter.lua @@ -1,7 +1,7 @@ return { 'akinsho/flutter-tools.nvim', - lazy = true, + lazy = false, filetype = 'dart', dependencies = { 'nvim-lua/plenary.nvim', diff --git a/lua/plugins/hurl.lua b/lua/plugins/hurl.lua new file mode 100644 index 0000000..cd949ee --- /dev/null +++ b/lua/plugins/hurl.lua @@ -0,0 +1,39 @@ +local IS_DEV = false + +return { + { + "jellydn/hurl.nvim", + dir = IS_DEV and "~/Projects/research/hurl.nvim" or nil, + ft = "hurl", + dependencies = { "MunifTanjim/nui.nvim", "nvim-treesitter/nvim-treesitter" }, + opts = { + mode = "split", + auto_close = false, + debug = false, + show_notification = false, + formatters = { + json = { "jq" }, + html = { + "prettier", + "--parser", + "html", + }, + }, + }, + keys = { + -- Run API request + { "<leader>rA", "<cmd>HurlRunner<CR>", desc = "Hurl - Run All requests" }, + { "<leader>ra", "<cmd>HurlRunnerAt<CR>", desc = "Hurl - Run Api request" }, + { "<leader>re", "<cmd>HurlRunnerToEntry<CR>", desc = "Hurl -Run Api request to entry" }, + { "<leader>th", "<cmd>HurlToggleMode<CR>", desc = "Hurl - Toggle Mode" }, + { "<leader>rv", "<cmd>HurlVerbose<CR>", desc = "Hurl - Run Api in verbose mode" }, + -- Run Hurl request in visual mode + { "<leader>rh", ":HurlRunner<CR>", desc = "Hurl Runner", mode = "v" }, + -- Show last response + { "<leader>rh", "<cmd>HurlShowLastResponse<CR>", desc = "Hurl History", mode = "n" }, + -- Manage variable + { "<leader>hg", ":HurlSetVariable", desc = "Hurl - Set global variable" }, + { "<leader>hG", "<cmd>HurlManageVariable<CR>", desc = "Hurl - Manage global variable" }, + }, + }, +} diff --git a/lua/plugins/icon-picker.lua b/lua/plugins/icon-picker.lua index a466b6a..adb1bb4 100644 --- a/lua/plugins/icon-picker.lua +++ b/lua/plugins/icon-picker.lua @@ -3,7 +3,7 @@ return { keys = { { "<Leader><Leader>i", "<cmd>IconPickerNormal nerd_font<cr>", mode = "n", desc = "IconPicker NerdFont Insert" }, { "<Leader><Leader>y", "<cmd>IconPickerYank nerd_font<cr>", mode = "n", desc = "IconPicker NerdFont Yank" }, - { "<C-o>", "<cmd>IconPickerInsert nerd_font<cr>", mode = "i", desc = "IconPicker NerdFont Insert mode" }, + { "<C-o>", "<cmd>IconPickerInsert nerd_font emoji alt_font nerd_font_v3 symbols <cr>", mode = "i", desc = "IconPicker NerdFont Insert mode" }, }, opts = { disable_legacy_commands = true }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 0799874..eae804e 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -21,8 +21,5 @@ return { enable = true, auto_install = false, }, - servers = { - phpactor = { enable = true }, - }, }, } diff --git a/lua/plugins/navigator.lua b/lua/plugins/navigator.lua new file mode 100644 index 0000000..53a7735 --- /dev/null +++ b/lua/plugins/navigator.lua @@ -0,0 +1,43 @@ +-- [[ +-- Use <c-e> or :q! to kill the floating window +-- <up/down> (or <c-n>, <c-p>) to move +-- <c-o> or <CR> to open location or apply code actions. Note: <CR> might be bound in insert mode by other plugins +-- ]] +return { + { + "ray-x/navigator.lua", + event = "LspAttach", + dependencies = { + { "ray-x/guihua.lua", build = "cd lua/fzy && make" }, + { + "neovim/nvim-lspconfig", + }, + }, + opts = { + default_mapping = false, + lsp = { + disable_lsp = "all", + hover = { + enable = false, + }, + }, + }, + -- Refer more usage on https://raw.githubusercontent.com/ray-x/navigator.lua/master/lua/navigator/lspclient/mapping.lua + keys = { + { "<leader>gr", ":lua require'navigator.reference'.async_ref()<cr>", desc = "Navigator - Async reference" }, + { "<leader>gS", ":lua require'navigator.symbols'.document_symbols()<cr>", desc = "Navigator - Document symbols" }, + { + "<leader>gw", + ":lua require'navigator.workspace'.workspace_symbol_live()<cr>", + desc = "Navigator - workspace symbols live", + }, + { "<leader>gd", ":lua require'navigator.definition'.definition()<cr>", desc = "Navigator - Definition" }, + { + "<leader>gp", + ":lua require'navigator.definition'.definition_preview()<cr>", + desc = "Navigator - Definition preview", + }, + { "<leader>ga", ":lua require'navigator.codeAction'.code_action()<cr>", desc = "Navigator - Code Action" }, + }, + }, +} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index 2afc490..c00f12e 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -10,11 +10,17 @@ return { "nvim-neotest/neotest-plenary", "nvim-neotest/neotest-vim-test", "anuvyklack/hydra.nvim", + "nvim-neotest/neotest-python", }, config = function() local neotest = require "neotest" neotest.setup { adapters = { + ["neotest-python"] = { + -- Here you can specify the settings for the adapter, i.e. + -- runner = "pytest", + -- python = ".venv/bin/python", + }, require "neotest-go", require('rustaceanvim.neotest'), require "neotest-plenary", diff --git a/lua/plugins/note.lua b/lua/plugins/note.lua new file mode 100644 index 0000000..2728bde --- /dev/null +++ b/lua/plugins/note.lua @@ -0,0 +1,29 @@ +return { + { + "jellydn/my-note.nvim", + dependencies = { "MunifTanjim/nui.nvim" }, + keys = { + { + "<leader>mn", + "<cmd>MyNote<cr>", + desc = "Open MyNote", + }, + { + "<leader>mg", + "<cmd>MyNote global<cr>", + desc = "Open MyNote Global", + }, + }, + opts = { + files = { + -- Using the parent .git folder as the cwd + cwd = function() + local bufPath = vim.api.nvim_buf_get_name(0) + local cwd = require("lspconfig").util.root_pattern(".git")(bufPath) + + return cwd + end, + }, + }, + }, +} diff --git a/lua/plugins/nvim-ts-autotag.lua b/lua/plugins/nvim-ts-autotag.lua new file mode 100644 index 0000000..59473b2 --- /dev/null +++ b/lua/plugins/nvim-ts-autotag.lua @@ -0,0 +1,7 @@ +return { + 'windwp/nvim-ts-autotag', + ft = {'html', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'svelte', 'vue', 'php', 'jsx', 'tsx', 'erb', 'ejs', 'pug', 'liquid', 'hbs', 'twig', 'blade', 'html.handlebars'}, + config = function() + require('nvim-ts-autotag').setup() + end +} diff --git a/lua/plugins/rayso.lua b/lua/plugins/rayso.lua new file mode 100644 index 0000000..8821e47 --- /dev/null +++ b/lua/plugins/rayso.lua @@ -0,0 +1,10 @@ +return { + { + "TobinPalmer/rayso.nvim", + cmd = { "Rayso" }, + keys = { + { "<leader>cs", "<cmd>Rayso<cr>", desc = "Screenshot code" }, + }, + config = true, + }, +} diff --git a/lua/plugins/spectre.lua b/lua/plugins/spectre.lua index 7510c7a..e3840af 100644 --- a/lua/plugins/spectre.lua +++ b/lua/plugins/spectre.lua @@ -1,5 +1,69 @@ +--- General configuration for spectre base on current git repo +---@param default_opts table | nil +---@return table +function _G.get_spectre_options(default_opts) + local Path = require("utils.path") + local opts = default_opts or {} + + if Path.is_git_repo() then + opts.cwd = Path.get_git_root() + end + + return opts +end + return { - "nvim-pack/nvim-spectre", - keys = { { "<leader>F", ":Spectre<cr>", desc = "Spectre Search open" } }, - config = true, + { "MagicDuck/grug-far.nvim", enabled = false }, + { + -- Search and replace with pattern + "nvim-pack/nvim-spectre", + cmd = "Spectre", + opts = { open_cmd = "noswapfile vnew" }, + keys = { + { + "<leader>sr", + function() + require("spectre").open() + end, + desc = "Replace in files", + }, + { + "<leader>sp", + ":lua require('spectre').open(_G.get_spectre_options())<CR>", + desc = "Replace in files (Root dir)", + }, + -- Search current word + { + "<leader>sP", + ":lua require('spectre').open_visual(_G.get_spectre_options({ select_word = true }))<CR>", + desc = "Replace current word (Root dir)", + }, + -- Open search with select word in visual mode + { + "<leader>sr", + ":lua require('spectre').open_visual(_G.get_spectre_options())<CR>", + mode = "v", + silent = true, + desc = "Replace current word (Root dir)", + }, + -- Search on current file + { + "<leader>sf", + ":lua require('spectre').open_file_search(_G.get_spectre_options({ select_word = true }))<CR>", + desc = "Replace in current file", + }, + }, + }, + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + opts.left = opts.left or {} + table.insert(opts.left, { + title = "Spectre", + ft = "spectre_panel", + size = { width = 0.3 }, + }) + end, + }, } diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua index 3f96d83..fd105c5 100644 --- a/lua/plugins/undotree.lua +++ b/lua/plugins/undotree.lua @@ -1,11 +1,37 @@ return { - "mbbill/undotree", - lazy = false, -- needs to be explicitly set, because of the keys property - keys = { - { - "<leader>u", - vim.cmd.UndotreeToggle, - desc = "Toggle undotree", + { + "mbbill/undotree", + cmd = "UndotreeToggle", + keys = { + -- [U]ndo [T]ree + { "<leader>uT", "<cmd>UndotreeToggle<cr>", desc = "Undo Tree Toggle" }, }, + init = function() + -- Persist undo, refer https://github.com/mbbill/undotree#usage + local undodir = vim.fn.expand("~/.cache/undodir") + + if vim.fn.has("persistent_undo") == 1 then + if vim.fn.isdirectory(undodir) == 0 then + os.execute("mkdir -p " .. undodir) + end + + vim.opt.undodir = undodir + vim.opt.undofile = true + end + + -- set layout style to 2, let g:undotree_WindowLayout = 2 + vim.g.undotree_WindowLayout = 2 + end, + }, + { + "folke/edgy.nvim", + optional = true, + opts = function(_, opts) + opts.left = opts.left or {} + table.insert(opts.left, { + title = "Undo Tree", + ft = "undotree", + }) + end, }, } diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua index b9a47db..2d8d47d 100644 --- a/lua/plugins/which-key.lua +++ b/lua/plugins/which-key.lua @@ -2,7 +2,17 @@ return { "folke/which-key.nvim", event = "VeryLazy", opts = { - preset = "modern" + preset = "modern", + spec = { + { "<leader>a", group = "ai" }, + { "gm", group = "+Copilot chat" }, + { "gmh", desc = "Show help" }, + { "gmd", desc = "Show diff" }, + { "gmp", desc = "Show system prompt" }, + { "gms", desc = "Show selection" }, + { "gmy", desc = "Yank diff" }, + }, + }, keys = { { diff --git a/lua/plugins/zenmode.lua b/lua/plugins/zenmode.lua new file mode 100644 index 0000000..a6922c6 --- /dev/null +++ b/lua/plugins/zenmode.lua @@ -0,0 +1,44 @@ +-- Calculate min width of the window should be 70% of the editor width or 90 columns +-- whichever is smaller +local function zen_mode_width() + local width = vim.api.nvim_win_get_width(0) + local min_width = math.max(width * 0.70, 90) + return math.min(width, min_width) +end + +return { + { + "folke/zen-mode.nvim", + cmd = { "ZenMode" }, + opts = { + window = { + width = zen_mode_width(), + }, + plugins = { + options = { + enabled = true, + ruler = false, -- disables the ruler text in the cmd line area + showcmd = false, -- disables the command in the last line of the screen + laststatus = 0, -- turn off the statusline in zen mode + }, + -- NOTE: Those options are disables by default, change to enabled = true to enable + gitsigns = { enabled = false }, -- disables git signs + tmux = { enabled = false }, -- disables the tmux statusline + -- NOTE: Need to add to wezterm config https://github.com/folke/zen-mode.nvim#wezterm + wezterm = { + enabled = false, + font = "+1", -- +1 font size or fixed size, e.g. 21 + }, + }, + }, + config = true, + keys = { + -- add <leader>cz to enter zen mode + { + "<leader>cz", + "<cmd>ZenMode<cr>", + desc = "Distraction Free Mode", + }, + }, + }, +} |