From f1e18ce6b1ba4271f1292ef6712570c3b93aae46 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sat, 22 Feb 2025 16:41:28 +0000 Subject: [PATCH] Migrate to snacks nvim --- nvim/lua/plugs/fzf.lua | 71 ----------------------------- nvim/lua/plugs/indent_blankline.lua | 32 ------------- nvim/lua/plugs/noice.lua | 9 ---- nvim/lua/plugs/smear_cursor.lua | 19 -------- nvim/lua/plugs/snacks.lua | 63 +++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 131 deletions(-) delete mode 100644 nvim/lua/plugs/fzf.lua delete mode 100644 nvim/lua/plugs/indent_blankline.lua delete mode 100644 nvim/lua/plugs/smear_cursor.lua create mode 100644 nvim/lua/plugs/snacks.lua diff --git a/nvim/lua/plugs/fzf.lua b/nvim/lua/plugs/fzf.lua deleted file mode 100644 index 3aa8088..0000000 --- a/nvim/lua/plugs/fzf.lua +++ /dev/null @@ -1,71 +0,0 @@ -return { - "ibhagwan/fzf-lua", - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = { - "telescope", - winopts = { - preview = { - default = "bat" - } - }, - lsp = { - workspace_symbols = { - symbol_kinds = { "Variable", "Function", "Method", "Class", "Struct", "Interface" }, - }, - }, - previewers = { - builtin = { - -- turn off syntax highlighting for files with more than 100KB - -- this avoid hanging when previewing large files (due to treesitter parsing on minified files) - syntax_limit_b = 1024 * 100, -- 100KB - } - } - }, - config = function() - local fzf = require("fzf-lua") - local pickers = { - { - mapping = "o", - action = function() - fzf.files({ - git_icons = false, - }) - end - }, - { - mapping = "a", - action = function() - fzf.live_grep_native({ - git_icons = false, - rg_opts = "--hidden --column --line-number --no-heading --color=always --smart-case", - fzf_opts = { - ['--exact'] = false, -- Disable exact matching - }, - }) - end - }, - { - mapping = "g", - action = function() - fzf.git_bcommits({}) - end - }, - { - mapping = "s", - action = function() - fzf.lsp_live_workspace_symbols({}) - end - } - } - - local keymaps = {} - keymaps.n = {} - for _, picker in ipairs(pickers) do - keymaps.n["t" .. picker.mapping] = { - cmd = picker.action - } - end - - require("utils").add_keymaps(keymaps) - end -} diff --git a/nvim/lua/plugs/indent_blankline.lua b/nvim/lua/plugs/indent_blankline.lua deleted file mode 100644 index e009902..0000000 --- a/nvim/lua/plugs/indent_blankline.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - event = "BufRead", - config = function() - local ibl = require("ibl") - ibl.setup({ - debounce = 100, - indent = { - char = "▏", - }, - scope = { - enabled = true, - char = "▏", - show_start = false, - show_end = false, - highlight = { "IblScope" }, - }, - }) - - local colors = require("ayu.colors") - colors.generate(true) - local highlights = { - { "IblScope", { fg = colors.keyword } }, - { "@ibl.scope.char.1", { fg = colors.keyword } }, - } - - for _, hl in ipairs(highlights) do - vim.api.nvim_set_hl(0, hl[1], hl[2]) - end - end -} diff --git a/nvim/lua/plugs/noice.lua b/nvim/lua/plugs/noice.lua index e15c16a..f31c47b 100644 --- a/nvim/lua/plugs/noice.lua +++ b/nvim/lua/plugs/noice.lua @@ -4,15 +4,6 @@ return { lazy = true, dependencies = { { "MunifTanjim/nui.nvim", lazy = true }, - { - "rcarriga/nvim-notify", - opts = { - background_colour = "#24273a", - fps = 1, - render = "compact", - stages = "static" - } - } }, opts = { lsp = { diff --git a/nvim/lua/plugs/smear_cursor.lua b/nvim/lua/plugs/smear_cursor.lua deleted file mode 100644 index 63984b1..0000000 --- a/nvim/lua/plugs/smear_cursor.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "sphamba/smear-cursor.nvim", - opts = { - smear_between_buffers = true, - - min_horizontal_distance_smear = 3, - min_vertical_distance_smear = 2, - - scroll_buffer_space = true, - smear_insert_mode = false, - - cursor_color = "#FFCC66", - transparent_bg_fallback_color = "#303030", - - stiffness = 0.85, - trailing_stiffness = 0.7, - distance_stop_animating = 0.5, - }, -} diff --git a/nvim/lua/plugs/snacks.lua b/nvim/lua/plugs/snacks.lua new file mode 100644 index 0000000..27bed99 --- /dev/null +++ b/nvim/lua/plugs/snacks.lua @@ -0,0 +1,63 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + gitbrowse = { enabled = true, }, + picker = { enabled = true, }, + dashboard = { enabled = true, }, + debug = { enabled = true, }, + indent = { + enabled = true, + animate = { + enabled = false, + }, + }, + input = { enabled = true, }, + notifier = { enabled = true, }, + quickfile = { enabled = true, }, + scroll = { + enabled = true, + animate = { + duration = { step = 7, total = 250 }, + easing = "outCirc", + }, + animate_repeat = { + delay = 100, + duration = { step = 3, total = 50 }, + easing = "outCirc", + }, + }, + words = { + enabled = true, + debounce = 100, + }, + zen = { + enabled = true, + toggles = { dim = false, } + }, + }, + keys = { + { "z", function() Snacks.zen() end, }, + + { "to", function() Snacks.picker.smart() end, }, + { "ta", function() Snacks.picker.grep() end, }, + { "tg", function() Snacks.picker.git_log_file() end, }, + { "ts", function() Snacks.picker.lsp_workspace_symbols() end, }, + { "tn", function() Snacks.picker.notifications() end }, + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + _G.inspect = function(...) + Snacks.debug.inspect(...) + end + _G.backtrace = function() + Snacks.debug.backtrace() + end + vim.print = _G.inspect + end, + }) + end +}