From 3e7934784d41de3c1fa548e589ab1763633a8d24 Mon Sep 17 00:00:00 2001 From: atropos Date: Sun, 2 Feb 2025 14:25:37 +0000 Subject: [PATCH] Bunch of changes again. --- lazy-lock.json | 11 ++- lua/atro/globals/keymaps.lua | 4 +- lua/atro/plugins/editor.lua | 12 ++- lua/atro/plugins/file_explorer.lua | 136 ++++++++++++++++++++++++++--- lua/atro/plugins/git.lua | 23 ++++- lua/atro/plugins/motion.lua | 35 +++++++- lua/atro/plugins/other.lua | 32 +++++++ 7 files changed, 232 insertions(+), 21 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 722b741..48a0cb2 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -3,9 +3,9 @@ "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "actions-preview.nvim": { "branch": "master", "commit": "9f52a01c374318e91337697ebed51c6fae57f8a4" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, "blink-ripgrep.nvim": { "branch": "main", "commit": "519ac7894113f6a7b517b157c26e31fbd58a0de5" }, "blink.cmp": { "branch": "main", "commit": "b6f11a0aa33e601c469a126e3ed6e35208fe3ea3" }, - "blink.compat": { "branch": "main", "commit": "1176525a78319a208300a1910b6fd9e0cfabff25" }, "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, "catppuccin": { "branch": "main", "commit": "4965db2d6155c25db4e8417465fc2703fdf4c2b7" }, "cheatsheet.nvim": { "branch": "master", "commit": "9716f9aaa94dd1fd6ce59b5aae0e5f25e2a463ef" }, @@ -23,9 +23,11 @@ "dropbar.nvim": { "branch": "master", "commit": "f11b27344dc3675cdaeffa9e1e5cab0442abb0fa" }, "flash.nvim": { "branch": "main", "commit": "f899265876ecdcf7352dbc9f0adf87068cedefbb" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "garbage-day.nvim": { "branch": "main", "commit": "750ef08ae6031ee3683014c5349144340c08ead6" }, "git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" }, "git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" }, "git.nvim": { "branch": "main", "commit": "164daed4eff61bd6bee6f1c97cb78144b9374022" }, + "gitgraph.nvim": { "branch": "main", "commit": "01e466b32c346a165135dd47d42f1244eca06572" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, "gitsigns.nvim": { "branch": "main", "commit": "9b36d497495436c135659902054ee637e0ba6021" }, "gopher.nvim": { "branch": "main", "commit": "0ed14a40d9799ac8d92aaf9eb1cd9be22ffd6b14" }, @@ -55,6 +57,7 @@ "mason-lock.nvim": { "branch": "main", "commit": "86614f76c3442fba1c5c8d79aa1efcb3ad69de1c" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "modes.nvim": { "branch": "main", "commit": "1e34663c32e8f5d915921a938e0dc4e3e788ceb8" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "5d172e8315444dbc32867d1c7b04d8e7e68ec4e1" }, "neogen": { "branch": "main", "commit": "dd0301bfba1f83a3bc009b5430fce7aa3cee6941" }, "neogit": { "branch": "master", "commit": "63124cf520ff24d09deb3b850e053908ab0fc66a" }, "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, @@ -78,6 +81,7 @@ "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-lightbulb": { "branch": "master", "commit": "416fd563117f4fd21969706e19d463e81fbf4691" }, "nvim-lint": { "branch": "master", "commit": "789b7ada1b4f00e08d026dffde410dcfa6a0ba87" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" }, "nvim-lspconfig": { "branch": "master", "commit": "f98fa715acc975c2dd5fb5ba7ceddeb1cc725ad2" }, "nvim-neoclip.lua": { "branch": "main", "commit": "90e4dd66bb6b1cc0c03f01aaf8b005f69f565421" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, @@ -87,6 +91,7 @@ "nvim-rulebook": { "branch": "main", "commit": "daeb662a331af495a0ff98ca8bd6bc66b5f97db8" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, "nvim-spider": { "branch": "main", "commit": "2b38e3e95e143313d78ca098eeecda7aebfce925" }, + "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, "nvim-treesitter": { "branch": "master", "commit": "4988b7068001b3a772c7cc738708341e612e3c26" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ufo": { "branch": "main", "commit": "81f5ffa6e8ba27c48403cf681d4b383d924e03e4" }, @@ -107,6 +112,7 @@ "sqlite.lua": { "branch": "master", "commit": "b487fcc8937b683942a1f7d9662fcf50ca5acd58" }, "stopinsert.nvim": { "branch": "main", "commit": "600cc582ff981dfbcc3f6a33979ee0cb01235c31" }, "structlog.nvim": { "branch": "main", "commit": "45b26a2b1036bb93c0e83f4225e85ab3cee8f476" }, + "tabout.nvim": { "branch": "master", "commit": "9a3499480a8e53dcaa665e2836f287e3b7764009" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "aa6a7045b3984be2b6581741dbe9200f1701f7f7" }, @@ -126,6 +132,5 @@ "vim-uppercase-sql": { "branch": "master", "commit": "58bfde1d679a1387dabfe292b38d51d84819b267" }, "vim-wakatime": { "branch": "master", "commit": "e46d7c4f98ee0f40782008dd60cb2a79c377fb1d" }, "virtual-types.nvim": { "branch": "master", "commit": "d652ec0b1781bbb0e83dc588fb62d638006cf61e" }, - "which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" }, - "yazi.nvim": { "branch": "main", "commit": "9a39d68534cb5ae7250aa50fcc233335843dd786" } + "which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" } } diff --git a/lua/atro/globals/keymaps.lua b/lua/atro/globals/keymaps.lua index 1053c70..cdfd4c5 100644 --- a/lua/atro/globals/keymaps.lua +++ b/lua/atro/globals/keymaps.lua @@ -34,8 +34,8 @@ return require("atro.types.keymaps"):new({ set_conditional_breakpoint = { "bc", "Set conditional breakpoint", "n" }, }, motion = { - flash_jump = { "s", "Flash jump to next char iteration.", "nxo" }, - flash_treesitter = { "S", "Flash jump to treesitter points", "nxo" }, + flash_jump = { "s", "Flash jump to next char iteration.", "n" }, + flash_treesitter = { "S", "Flash jump to treesitter points", "n" }, close_all_goto_previews = { "gP", "Close all goto previews", "nv" }, open_goto_preview = { "gp", "Open goto preview", "nv" }, go_to_beginning_of_word = { "w", "Move to beginning of word", "nox" }, diff --git a/lua/atro/plugins/editor.lua b/lua/atro/plugins/editor.lua index 13bd2fa..1a99b49 100644 --- a/lua/atro/plugins/editor.lua +++ b/lua/atro/plugins/editor.lua @@ -2,6 +2,16 @@ local key = require("atro.utils").keyset ---@type LazyPlugin[] return { + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = { "VeryLazy" }, + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end, + }, { "chrisgrieser/nvim-rulebook", keys = { @@ -210,7 +220,7 @@ return { max_depth = 0, }, lsp = { - max_depth = 3, -- 3 is already a lot + max_depth = 3, -- 3 is already a lot valid_symbols = { "File", "Module", diff --git a/lua/atro/plugins/file_explorer.lua b/lua/atro/plugins/file_explorer.lua index 952038d..911f767 100644 --- a/lua/atro/plugins/file_explorer.lua +++ b/lua/atro/plugins/file_explorer.lua @@ -1,30 +1,140 @@ +---@type LazySpec[] return { - ---@type LazySpec + { - "mikavilpas/yazi.nvim", - event = "VeryLazy", + "neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, keys = { { - "-", + "fe", function() - require("yazi").yazi() + require("neo-tree.command").execute({ reveal = true, dir = require("atro.utils.init").GetGitRoot() }) end, - desc = "Open the file manager", + desc = "Reveal in Explorer", }, { - -- Open in the current working directory - "cw", + "fE", function() - require("yazi").yazi(nil, vim.fn.getcwd()) + require("neo-tree.command").execute({ reveal = true, dir = vim.uv.cwd() }) end, - desc = "Open the file manager in nvim's working directory", + desc = "Reveal in Explorer (cwd)", }, }, - ---@type YaziConfig + -- See: https://github.com/nvim-neo-tree/neo-tree.nvim opts = { + enable_git_status = true, + close_if_last_window = true, + popup_border_style = "rounded", + sort_case_insensitive = true, + + source_selector = { + winbar = false, + show_scrolled_off_parent_node = true, + padding = { left = 1, right = 0 }, + sources = { + { source = "filesystem", display_name = "  Files" }, --       + { source = "buffers", display_name = "  Buffers" }, --       + { source = "git_status", display_name = " 󰊢 Git" }, -- 󰊢       + }, + }, + + default_component_configs = { + indent = { + with_expanders = false, + }, + icon = { + folder_empty = "", + folder_empty_open = "", + default = "", + }, + modified = { + symbol = "•", + }, + name = { + trailing_slash = true, + highlight_opened_files = true, + use_git_status_colors = true, + }, + git_status = { + symbols = { + -- Change type + added = "A", + deleted = "D", + modified = "M", + renamed = "R", + -- Status type + untracked = "U", + ignored = "I", + unstaged = "", + staged = "S", + conflict = "C", + }, + }, + }, - -- if you want to open yazi instead of netrw, see below for more info - open_for_directories = false, + filesystem = { + bind_to_cwd = false, + follow_current_file = { enabled = false }, + find_by_full_path_words = true, + group_empty_dirs = true, + use_libuv_file_watcher = true, + + filtered_items = { + hide_dotfiles = false, + hide_gitignored = false, + hide_by_name = { + ".git", + ".hg", + ".svc", + ".DS_Store", + "thumbs.db", + ".sass-cache", + "node_modules", + ".pytest_cache", + ".mypy_cache", + "__pycache__", + ".stfolder", + ".stversions", + }, + never_show_by_pattern = { + "vite.config.js.timestamp-*", + }, + }, + }, + buffers = {}, + git_status = {}, + document_symbols = { + follow_cursor = true, + }, + }, + }, + { + "antosha417/nvim-lsp-file-operations", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-neo-tree/neo-tree.nvim", }, + config = function() + require("lsp-file-operations").setup({ + -- used to see debug logs in file `vim.fn.stdpath("cache") .. lsp-file-operations.log` + debug = false, + -- select which file operations to enable + operations = { + willRenameFiles = true, + didRenameFiles = true, + willCreateFiles = true, + didCreateFiles = true, + willDeleteFiles = true, + didDeleteFiles = true, + }, + -- how long to wait (in milliseconds) for file rename information before cancelling + timeout_ms = 10000, + }) + end, }, } diff --git a/lua/atro/plugins/git.lua b/lua/atro/plugins/git.lua index 96a6b7e..9ec8e5d 100644 --- a/lua/atro/plugins/git.lua +++ b/lua/atro/plugins/git.lua @@ -1,4 +1,25 @@ return { + { + -- TODO: Make keymap to open this (require('gitgraph').draw({}, { all = true, max_count = 5000 })) + -- TODO: Figure out how to conviniently close diffview after selecting (currently its via :tabc) + "isakbm/gitgraph.nvim", + dependencies = { "sindrets/diffview.nvim" }, + ---@type I.GGConfig + opts = { + hooks = { + -- Check diff of a commit + on_select_commit = function(commit) + vim.notify("DiffviewOpen " .. commit.hash .. "^!") + vim.cmd(":DiffviewOpen " .. commit.hash .. "^!") + end, + -- Check diff from commit a -> commit b + on_select_range_commit = function(from, to) + vim.notify("DiffviewOpen " .. from.hash .. "~1.." .. to.hash) + vim.cmd(":DiffviewOpen " .. from.hash .. "~1.." .. to.hash) + end, + }, + }, + }, { "tpope/vim-fugitive", event = "VeryLazy", @@ -19,7 +40,7 @@ return { }, { "dinhhuy258/git.nvim", - event = {"VeryLazy"}, + event = { "VeryLazy" }, opts = { keymaps = { -- Open blame window diff --git a/lua/atro/plugins/motion.lua b/lua/atro/plugins/motion.lua index 0688561..14bf982 100644 --- a/lua/atro/plugins/motion.lua +++ b/lua/atro/plugins/motion.lua @@ -1,10 +1,43 @@ ---@type LazySpec[] return { + -- Section: Overloads tab to jump out of the brackets when inside of them so that { | } -> { } | or ( | ) -> ( ) | + { + "abecodes/tabout.nvim", + lazy = true, + event = { "InsertCharPre" }, -- Set the event to 'InsertCharPre' for better compatibility + config = function() + require("tabout").setup({ + tabkey = "", -- key to trigger tabout, set to an empty string to disable + backwards_tabkey = "", -- key to trigger backwards tabout, set to an empty string to disable + act_as_tab = true, -- shift content if tab out is not possible + act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports ) + default_tab = "", -- shift default action (only at the beginning of a line, otherwise is used) + default_shift_tab = "", -- reverse shift default action, + enable_backwards = true, -- well ... + completion = false, -- if the tabkey is used in a completion pum + tabouts = { + { open = "'", close = "'" }, + { open = '"', close = '"' }, + { open = "`", close = "`" }, + { open = "(", close = ")" }, + { open = "[", close = "]" }, + { open = "{", close = "}" }, + }, + ignore_beginning = true, --[[ if the cursor is at the beginning of a filled element it will rather tab out than shift the content ]] + exclude = {}, -- tabout will ignore these filetypes + }) + end, + dependencies = { -- These are optional + "nvim-treesitter/nvim-treesitter", + "L3MON4D3/LuaSnip", + }, + opt = {}, + }, -- Section: Optimizes w,e and b motions by stop at the segments of a camelCase, SNAKE_CASE, or kebab-case variable and not just based on spaces/other separators themselves. { "chrisgrieser/nvim-spider", lazy = true, - event = "VeryLazy", + event = { "VeryLazy", "InsertCharPre" }, config = function() local keys = KEYMAPS.motion local spider = require("spider") diff --git a/lua/atro/plugins/other.lua b/lua/atro/plugins/other.lua index f074e84..611890e 100644 --- a/lua/atro/plugins/other.lua +++ b/lua/atro/plugins/other.lua @@ -1,6 +1,38 @@ local set = require("atro.utils").keyset ---@type LazySpec[] local plugins = { + { + "zeioth/garbage-day.nvim", + dependencies = "neovim/nvim-lspconfig", + event = "VeryLazy", + opts = { + -- Set it to true to stop all lsp clients except the current buffer, every time you enter a buffer. aggressive_mode ignores grace_period, and it only triggers when entering a buffer with a different filetype than the current buffer. Ensures the maximum RAM save. + aggressive_mode = false, + -- Table of LSP clients that should never be stopped. Useful for LSP clients that miss behave. + excluded_lsp_clients = { "null-ls", "marksman", "lua_ls" }, + -- Seconds to wait before stopping all LSP clients after neovim loses focus. + grace_period = 60 * 5, -- 5 minutes + -- Milliseconds to wait before restoring LSP after the mouse re-enters nvim. Useful to avoid waking up the LSP clients by accident when passing the mouse over it. + wakeup_delay = 0, + }, + }, + { + "LunarVim/bigfile.nvim", + opts = { + filesize = 2, -- size of the file in MiB, the plugin round file sizes to the closest MiB + pattern = { "*" }, -- autocmd pattern or function see <### Overriding the detection of big files> + features = { -- features to disable + "indent_blankline", + "illuminate", + "lsp", + "treesitter", -- I don't want to disable treesitter, it's too useful + "syntax", + "matchparen", -- Stays off even after leaving the big file + "vimopts", + "filetype", + }, + }, + }, { "tummetott/unimpaired.nvim", event = "VeryLazy",