diff --git a/.config/nvim/lua/core/autocommands.lua b/.config/nvim/lua/core/autocommands.lua index 80d337e..d5a63a7 100644 --- a/.config/nvim/lua/core/autocommands.lua +++ b/.config/nvim/lua/core/autocommands.lua @@ -68,26 +68,3 @@ vim.api.nvim_create_autocmd("FileType", { pattern = { "hcl", "helm" }, command = "setlocal shiftwidth=2 tabstop=2", }) - --- Disable some plugins on very large files -vim.api.nvim_create_autocmd({ "BufEnter" }, { - pattern = { "*" }, - callback = function(args) - local highlighter = require("vim.treesitter.highlighter") - local ts_was_active = highlighter.active[args.buf] - local file_size = vim.fn.getfsize(args.file) - if file_size > 1024 * 1024 then - vim.cmd("TSBufDisable highlight") - vim.cmd("syntax off") - vim.cmd("syntax clear") - vim.cmd("IlluminatePauseBuf") - vim.cmd("NoMatchParen") - vim.cmd("UfoDisable") - vim.cmd("IBLDisable") - vim.cmd("LspStop") - if ts_was_active then - vim.notify("File larger than 1MB; syntax highlighting and heavy CPU use plugins are turned off.") - end - end - end, -}) diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua index 616e9f4..03bc797 100644 --- a/.config/nvim/lua/core/keymaps.lua +++ b/.config/nvim/lua/core/keymaps.lua @@ -193,14 +193,10 @@ keymap("i", "jk", "", vim.tbl_extend("force", opts, { desc = "Exit insert m keymap("v", "<", "", ">gv", opts) --- NeoTree -keymap("n", "e", ":Neotree toggle", vim.tbl_extend("force", opts, { desc = "Toggle Neotree" })) -keymap( - "n", - "gg", - ":Neotree float git_status", - vim.tbl_extend("force", opts, { desc = "Open a float window with the git status" }) -) +-- FileTree +keymap("n", "e", function() + Snacks.explorer() +end, vim.tbl_extend("force", opts, { desc = "Toggle file explorer" })) -- Telescope keymap( @@ -234,7 +230,7 @@ keymap( vim.tbl_extend("force", opts, { desc = "Open a Telescope prompt to show all commands" }) ) --- Gitdiff +-- Git keymap( "n", "df", @@ -242,6 +238,13 @@ keymap( vim.tbl_extend("force", opts, { desc = "Open diff view file history for the current buffer" }) ) keymap("n", "dc", ":DiffviewClose", vim.tbl_extend("force", opts, { desc = "Close diff view" })) +-- Git +keymap({ "n", "v" }, "go", function() + Snacks.gitbrowse() +end, vim.tbl_extend("force", opts, { desc = "Git Browse" })) +keymap("n", "gg", function() + Snacks.picker.git_status() +end, vim.tbl_extend("force", opts, { desc = "Git Status" })) -- Projects keymap( diff --git a/.config/nvim/lua/core/lazy.lua b/.config/nvim/lua/core/lazy.lua index a721bbd..42cef1c 100644 --- a/.config/nvim/lua/core/lazy.lua +++ b/.config/nvim/lua/core/lazy.lua @@ -90,7 +90,6 @@ require("lazy").setup({ -- Plugins { "nvim-lua/plenary.nvim", lazy = true }, - { "echasnovski/mini.animate", event = "VeryLazy", version = "*" }, { "echasnovski/mini.comment", event = "VeryLazy", version = "*" }, { "echasnovski/mini.pairs", event = "VeryLazy", version = "*" }, { "echasnovski/mini.surround", event = "VeryLazy", version = "*" }, @@ -102,7 +101,6 @@ require("lazy").setup({ { "akinsho/bufferline.nvim", event = "VeryLazy", version = "v4.*" }, { "moll/vim-bbye" }, { "nvim-lualine/lualine.nvim", event = "VeryLazy" }, - { "lukas-reineke/indent-blankline.nvim", event = "BufReadPost", main = "ibl" }, { "nvim-zh/auto-save.nvim", event = "BufReadPost" }, { "folke/noice.nvim", @@ -122,9 +120,9 @@ require("lazy").setup({ }, { "nvim-treesitter/nvim-treesitter", event = "BufReadPost" }, { - "nvim-neo-tree/neo-tree.nvim", - version = "v3.x", - dependencies = { "MunifTanjim/nui.nvim" }, + "folke/snacks.nvim", + priority = 1000, + lazy = false, }, { "taybart/b64.nvim", event = "VeryLazy" }, { "tenxsoydev/karen-yank.nvim", event = "VeryLazy", config = true }, @@ -318,6 +316,6 @@ require("lazy").setup({ }, }, }, + { "towolf/vim-helm", ft = "helm" }, - { "robbles/logstash.vim" }, }, lazy_opts) diff --git a/.config/nvim/lua/plugins/bufferline.lua b/.config/nvim/lua/plugins/bufferline.lua index 897c998..8ab905c 100644 --- a/.config/nvim/lua/plugins/bufferline.lua +++ b/.config/nvim/lua/plugins/bufferline.lua @@ -17,7 +17,7 @@ bufferline.setup({ close_command = "Bdelete! %d", right_mouse_command = "Bdelete! %d", offsets = { - { filetype = "neo-tree", text = "", padding = 1 }, + { filetype = "snacks_picker_list", text = "", padding = 1 }, { filetype = "dapui_scopes", text = "", padding = 1 }, }, indicator = { @@ -30,10 +30,7 @@ bufferline.setup({ custom_areas = { left = function() - local text = "" - if not is_buffer_loaded("neo-tree") then - text = "  " .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. "  " - end + local text = "  " .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. "  " return { { text = text, fg = "#adbac7" } } end, diff --git a/.config/nvim/lua/plugins/illuminate.lua b/.config/nvim/lua/plugins/illuminate.lua index 0a9d737..df82905 100644 --- a/.config/nvim/lua/plugins/illuminate.lua +++ b/.config/nvim/lua/plugins/illuminate.lua @@ -6,7 +6,7 @@ require("illuminate").configure({ "avante", "lspsagafinder", "mason", - "neo-tree", + "snacks_picker_list", "packer", "starter", }, diff --git a/.config/nvim/lua/plugins/indentline.lua b/.config/nvim/lua/plugins/indentline.lua deleted file mode 100644 index d74be72..0000000 --- a/.config/nvim/lua/plugins/indentline.lua +++ /dev/null @@ -1,23 +0,0 @@ -require("ibl").setup({ - indent = { - char = "▏", - tab_char = "▏", - }, - scope = { - enabled = true, - show_start = false, - show_end = false, - }, - exclude = { - filetypes = { - "help", - "mini.starter", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - }, - }, -}) diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 8f29638..40a3d73 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -1,17 +1,14 @@ +require("plugins.snacks") require("plugins.blink") require("plugins.copilot") require("plugins.avante") require("plugins.telescope") -require("plugins.mini-animate") require("plugins.mini-comment") require("plugins.mini-pairs") -require("plugins.mini-starter") require("plugins.mini-surround") require("plugins.treesitter") require("plugins.gitsigns") -require("plugins.neo-tree") require("plugins.illuminate") -require("plugins.indentline") require("plugins.lsp") require("plugins.go") require("plugins.typescript") diff --git a/.config/nvim/lua/plugins/lsp/init.lua b/.config/nvim/lua/plugins/lsp/init.lua index 07f787e..676f19d 100644 --- a/.config/nvim/lua/plugins/lsp/init.lua +++ b/.config/nvim/lua/plugins/lsp/init.lua @@ -6,21 +6,15 @@ require("plugins.lsp.lsp-saga") local win = require("lspconfig.ui.windows") win.default_options.border = "rounded" -local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, -} - -for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) -end - local config = { virtual_text = false, signs = { - active = signs, + text = { + [vim.diagnostic.severity.ERROR] = "", + [vim.diagnostic.severity.WARN] = "", + [vim.diagnostic.severity.INFO] = "", + [vim.diagnostic.severity.HINT] = "", + }, }, update_in_insert = true, underline = true, @@ -34,15 +28,4 @@ local config = { prefix = "", }, } - -vim.diagnostic.config(config) - -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "rounded", -}) - -vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "rounded", -}) - vim.diagnostic.config(config) diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index 7c55e6d..f627d99 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -6,7 +6,7 @@ local diagnostics = { "diagnostics", sources = { "nvim_diagnostic" }, sections = { "error", "warn" }, - symbols = { error = " ", warn = "!" }, + symbols = { error = " ", warn = " " }, colored = false, always_visible = true, } @@ -84,7 +84,7 @@ require("lualine").setup({ path = 1, cond = function() if - vim.bo.filetype == "neo-tree" + vim.bo.filetype == "snacks_picker_list" or vim.bo.filetype == "mason" or vim.bo.filetype == "lazy" or vim.bo.filetype == "help" diff --git a/.config/nvim/lua/plugins/mini-animate.lua b/.config/nvim/lua/plugins/mini-animate.lua deleted file mode 100644 index dcebbb1..0000000 --- a/.config/nvim/lua/plugins/mini-animate.lua +++ /dev/null @@ -1,34 +0,0 @@ -local mouse_scrolled = false -for _, scroll in ipairs({ "Up", "Down" }) do - local key = "" - vim.keymap.set({ "", "i" }, key, function() - mouse_scrolled = true - return key - end, { expr = true }) -end - -vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = { "grug-far", "ministarter", "neo-tree" }, - callback = function() - vim.b.minianimate_disable = true - end, -}) - -local animate = require("mini.animate") -animate.setup({ - resize = { - timing = animate.gen_timing.linear({ duration = 50, unit = "total" }), - }, - scroll = { - timing = animate.gen_timing.linear({ duration = 150, unit = "total" }), - subscroll = animate.gen_subscroll.equal({ - predicate = function(total_scroll) - if mouse_scrolled then - mouse_scrolled = false - return false - end - return total_scroll > 1 - end, - }), - }, -}) diff --git a/.config/nvim/lua/plugins/mini-starter.lua b/.config/nvim/lua/plugins/mini-starter.lua deleted file mode 100644 index ca25014..0000000 --- a/.config/nvim/lua/plugins/mini-starter.lua +++ /dev/null @@ -1,37 +0,0 @@ -local starter = require("mini.starter") -local pad = string.rep(" ", 4) -local new_section = function(name, action, section) - return { name = name, action = action, section = pad .. section } -end - -local logo = table.concat({ - "", - "", - "", - "", - "███╗ ██╗██╗ ██╗██╗███╗ ███╗", - "████╗ ██║██║ ██║██║████╗ ████║", - "██╔██╗██║╚██╗ ██╔╝██║██╔████╔██║", - "██║╚████║ ╚████╔╝ ██║██║╚██╔╝██║", - "██║ ╚███║ ╚██╔╝ ██║██║ ╚═╝ ██║", - "╚═╝ ╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝", -}, "\n") - -starter.setup({ - evaluate_single = true, - header = logo, - footer = "", - items = { - new_section("Projects", "Telescope neovim-project discover", "Telescope"), - new_section("Recent files", "Telescope oldfiles", "Telescope"), - new_section("New file", "ene | startinsert", "Built-in"), - new_section("Quit", "qa", "Built-in"), - new_section("Lazy", "Lazy", "Config"), - new_section("Mason", "Mason", "Config"), - new_section("Tree-sitter", "TSUpdate", "Config"), - }, - content_hooks = { - starter.gen_hook.adding_bullet(pad .. " ", false), - starter.gen_hook.aligning("center", "top"), - }, -}) diff --git a/.config/nvim/lua/plugins/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua deleted file mode 100644 index 21bd934..0000000 --- a/.config/nvim/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,69 +0,0 @@ -vim.g.neo_tree_remove_legacy_commands = true - -require("neo-tree").setup({ - close_if_last_window = true, - auto_clean_after_session_restore = true, - open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "starter" }, - popup_border_style = "rounded", - default_component_configs = { - indent = { - padding = 0, - with_expanders = false, - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "", - default = "", - }, - git_status = { - symbols = { - added = "", - deleted = "", - modified = "", - renamed = "➜", - untracked = "★", - ignored = "◌", - unstaged = "✗", - staged = "✓", - conflict = "", - }, - }, - }, - window = { - width = 40, - mappings = { - ["o"] = "open", - ["Z"] = "expand_all_nodes", - }, - }, - filesystem = { - filtered_items = { - visible = false, - hide_dotfiles = false, - hide_gitignored = false, - hide_by_name = { - "__pycache__", - ".git", - }, - }, - follow_current_file = { - enabled = true, - }, - hijack_netrw_behavior = "open_current", - use_libuv_file_watcher = true, - }, - git_status = { - window = { - position = "float", - }, - }, - event_handlers = { - { - event = "neo_tree_buffer_enter", - handler = function(_) - vim.opt_local.signcolumn = "auto" - end, - }, - }, -}) diff --git a/.config/nvim/lua/plugins/neovim-project.lua b/.config/nvim/lua/plugins/neovim-project.lua index a25085f..c4720ab 100644 --- a/.config/nvim/lua/plugins/neovim-project.lua +++ b/.config/nvim/lua/plugins/neovim-project.lua @@ -14,7 +14,7 @@ require("neovim-project").setup({ filetype_autocmd_timeout = 0, session_manager_opts = { autosave_ignore_filetypes = { - "neo-tree", + "snacks_picker_list", "trouble", "grug-far", "copilot-chat", diff --git a/.config/nvim/lua/plugins/noice.lua b/.config/nvim/lua/plugins/noice.lua index 9907ac0..0ec1e6d 100644 --- a/.config/nvim/lua/plugins/noice.lua +++ b/.config/nvim/lua/plugins/noice.lua @@ -53,17 +53,5 @@ require("noice").setup({ }, opts = { skip = true }, }, - { - view = "popup", - filter = { - find = "File larger than", - }, - opts = { - size = { - width = 100, - height = 4, - }, - }, - }, }, }) diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua new file mode 100644 index 0000000..d6afc3d --- /dev/null +++ b/.config/nvim/lua/plugins/snacks.lua @@ -0,0 +1,42 @@ +require("snacks").setup({ + animate = {}, + bigfile = {}, + explorer = {}, + indent = { + indent = { char = "▏" }, + scope = { char = "▏" }, + }, + scroll = {}, + gitbrowse = {}, + image = {}, + dashboard = { + sections = { + { section = "header" }, + + { icon = "", desc = "Projects", action = ":Telescope neovim-project", key = "p", padding = 1 }, + + { icon = "", key = "n", desc = "New File", action = ":ene | startinsert" }, + { + icon = "", + desc = "Recent Files", + action = ":lua Snacks.dashboard.pick('oldfiles')", + key = "r", + }, + { icon = "", key = "q", desc = "Quit", action = ":qa", padding = 1 }, + + { icon = "", title = "Config" }, + { + icon = "󰒲", + desc = "Lazy", + action = ":Lazy", + enabled = package.loaded.lazy ~= nil, + key = "l", + indent = 2, + }, + { icon = "", desc = "Mason", action = ":Mason", key = "m", indent = 2 }, + { icon = "", desc = "Tree-sitter", action = ":TSUpdate", key = "t", indent = 2, padding = 2 }, + + { section = "startup" }, + }, + }, +})