From 5716a3de5aef2dc2a7623b4aa2ad5685847bea12 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Tue, 20 Aug 2024 10:37:28 +0200 Subject: [PATCH] feat: add mini.nvim, flash, auto-dark-mode --- lua/weeheavy/plugins/auto-dark-mode.lua | 21 +++++++++ lua/weeheavy/plugins/flash.lua | 59 +++++++++++++++++++++++++ lua/weeheavy/plugins/mini.lua | 9 ++++ 3 files changed, 89 insertions(+) create mode 100644 lua/weeheavy/plugins/auto-dark-mode.lua create mode 100644 lua/weeheavy/plugins/flash.lua create mode 100644 lua/weeheavy/plugins/mini.lua diff --git a/lua/weeheavy/plugins/auto-dark-mode.lua b/lua/weeheavy/plugins/auto-dark-mode.lua new file mode 100644 index 0000000..dd25bcf --- /dev/null +++ b/lua/weeheavy/plugins/auto-dark-mode.lua @@ -0,0 +1,21 @@ +-- Adds git related signs to the gutter, as well as utilities for managing changes +return { + "f-person/auto-dark-mode.nvim", + opts = { + -- in ms. needs to be larger than whatever time your system takes to + -- query dark mode. Otherwise you risk freezing neovim on shutdown + update_interval = 4000, + set_dark_mode = function() + vim.api.nvim_set_option_value("background", "dark", {}) + vim.cmd("colorscheme tokyonight-storm") + end, + set_light_mode = function() + vim.api.nvim_set_option_value("background", "light", {}) + vim.cmd("colorscheme tokyonight-day") + end, + }, + config = function() + local darkmode = require("auto-dark-mode") + darkmode.setup({}) + end, +} diff --git a/lua/weeheavy/plugins/flash.lua b/lua/weeheavy/plugins/flash.lua new file mode 100644 index 0000000..13bb3ce --- /dev/null +++ b/lua/weeheavy/plugins/flash.lua @@ -0,0 +1,59 @@ +-- Navigate code fast +-- https://github.com/folke/flash.nvim +return { + "folke/flash.nvim", + opts = { + label = { + -- allow uppercase labels + uppercase = true, + -- add any labels with the correct case here, that you want to exclude + exclude = "", + -- add a label for the first match in the current window. + -- you can always jump to the first match with `` + current = true, + -- show the label after the match + after = true, ---@type boolean|number[] + -- show the label before the match + before = false, ---@type boolean|number[] + -- position of the label extmark + -- style = "overlay", ---@type "eol" | "overlay" | "right_align" | "inline" + -- flash tries to re-use labels that were already assigned to a position, + -- when typing more characters. By default only lower-case labels are re-used. + reuse = "lowercase", ---@type "lowercase" | "all" | "none" + -- for the current window, label targets closer to the cursor first + distance = true, + -- minimum pattern length to show labels + -- Ignored for custom labelers. + min_pattern_length = 0, + -- Enable this to use rainbow colors to highlight labels + -- Can be useful for visualizing Treesitter ranges. + rainbow = { + enabled = true, + -- number between 1 and 9 + shade = 4, + }, + }, + highlight = { + -- show a backdrop with hl FlashBackdrop + backdrop = true, + -- Highlight the search matches + matches = false, + -- extmark priority + priority = 5000, + groups = { + match = "FlashMatch", + current = "FlashCurrent", + backdrop = "FlashBackdrop", + label = "FlashLabel", + }, + }, + }, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} diff --git a/lua/weeheavy/plugins/mini.lua b/lua/weeheavy/plugins/mini.lua new file mode 100644 index 0000000..9259da7 --- /dev/null +++ b/lua/weeheavy/plugins/mini.lua @@ -0,0 +1,9 @@ +-- Adds git related signs to the gutter, as well as utilities for managing changes +return { + "echasnovski/mini.nvim", + version = false, + config = function() + local icons = require("mini.icons") + icons.setup({}) + end, +}