feat: add mini.ai

This commit is contained in:
Oliver Ladner 2025-05-20 15:53:29 +02:00
commit 600306f9be
4 changed files with 67 additions and 77 deletions

View file

@ -1,14 +1,15 @@
# Neovim cheat sheet # Neovim cheat sheet
Heavily customized. Related blog post: https://lugh.ch/neovim-lessons-learned.html
## BASICS ## BASICS
- `:checkhealth [<pluginname>]` check base or plugin status - `:checkhealth [<pluginname>]` check base or plugin status
- `:checkhealth vim.lsp` show details of LSP attached to buffer - `:checkhealth vim.lsp` show details of LSP attached to buffer
- `:verbose set expandtab?` check where `expandtab` has been set last - `:verbose set expandtab?` check where `expandtab` has been set last
- `:Lazy` show package manager UI - `:Lazy` show package manager TUI
- `:Mason` show Mason UI - `:Mason` show LSP management TUI
- `:TSUpdate` update all Tree-sitter parsers - `:TSUpdate` update all Tree-sitter parsers
- `:LspInfo` show attached LSP client details
- `:ConformInfo` useful to debug why a formatter times out - `:ConformInfo` useful to debug why a formatter times out
## NAVIGATING ## NAVIGATING
@ -27,19 +28,19 @@
## Buffers ## Buffers
- `leader`+`leader` lists open buffers in `snipe.nvim` - `leader`+`leader` lists open buffers in `snipe.nvim`
- In snipe.nvim popup: Hit `d` to close the selected buffer - In snipe.nvim popup: Hit `D` to close the selected buffer
- `:bd` close current buffer - `:bd` close current buffer
## Text ## Text
- `w/e` move to **start/end of next word** (ignores punctuation due to remap) - `w/e` move to **start/end of next word**
- `b` move to **start of previous word** (ignores punctuation due to remap) - `b` move to **start of previous word**
- `Ctrl`+`0` start of line - `Ctrl`+`0` start of line
- `Ctrl`+`$` end of line - `Ctrl`+`$` end of line
- `Ctrl`+`d/u` scroll down/up 1/2 page while keeping the cursor centered - `Ctrl`+`d/u` scroll down/up 1/2 page while keeping the cursor centered
- `Ctrl`+`o` jump to location you were before (e.g. after using `gg`) - `Ctrl`+`o` jump to location you were before (e.g. after using `gg`)
- `Ctrl`+`i` jump back to location you were before (after using `Ctrl`+`o`) - `Ctrl`+`i` jump back to location you were before (after using `Ctrl`+`o`)
- `s<chars>` highlight jump targets via `flash.nvim` - `s<chars>` highlight jump targets w/ `flash.nvim`
## LSP, Code & Diagnostics ## LSP, Code & Diagnostics
@ -92,6 +93,8 @@
- `:windo diffthis` open `vimdiff` for open splits - `:windo diffthis` open `vimdiff` for open splits
- `:vert diffsplit <other/file>` diff this file and `<other/file>` - `:vert diffsplit <other/file>` diff this file and `<other/file>`
- `:windo diffoff` to close diff view - `:windo diffoff` to close diff view
- `ciq` change inside quotes w/ `mini.ai`
- `caq` change around quotes w/ `mini.ai`
## SELECTING ## SELECTING

Binary file not shown.

View file

@ -1,59 +1,59 @@
-- Navigate code fast -- Navigate code fast
-- https://github.com/folke/flash.nvim -- https://github.com/folke/flash.nvim
return { return {
"folke/flash.nvim", "folke/flash.nvim",
opts = { opts = {
label = { label = {
-- allow uppercase labels -- allow uppercase labels
uppercase = true, uppercase = true,
-- add any labels with the correct case here, that you want to exclude -- add any labels with the correct case here, that you want to exclude
exclude = "", exclude = "",
-- add a label for the first match in the current window. -- add a label for the first match in the current window.
-- you can always jump to the first match with `<CR>` -- you can always jump to the first match with `<CR>`
current = true, current = true,
-- show the label after the match -- show the label after the match
after = true, ---@type boolean|number[] after = true, ---@type boolean|number[]
-- show the label before the match -- show the label before the match
before = false, ---@type boolean|number[] before = false, ---@type boolean|number[]
-- position of the label extmark -- position of the label extmark
-- style = "overlay", ---@type "eol" | "overlay" | "right_align" | "inline" -- style = "overlay", ---@type "eol" | "overlay" | "right_align" | "inline"
-- flash tries to re-use labels that were already assigned to a position, -- 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. -- when typing more characters. By default only lower-case labels are re-used.
reuse = "lowercase", ---@type "lowercase" | "all" | "none" reuse = "lowercase", ---@type "lowercase" | "all" | "none"
-- for the current window, label targets closer to the cursor first -- for the current window, label targets closer to the cursor first
distance = true, distance = true,
-- minimum pattern length to show labels -- minimum pattern length to show labels
-- Ignored for custom labelers. -- Ignored for custom labelers.
min_pattern_length = 0, min_pattern_length = 0,
-- Enable this to use rainbow colors to highlight labels -- Enable this to use rainbow colors to highlight labels
-- Can be useful for visualizing Treesitter ranges. -- Can be useful for visualizing Treesitter ranges.
rainbow = { rainbow = {
enabled = true, enabled = true,
-- number between 1 and 9 -- number between 1 and 9
shade = 4, shade = 4,
}, },
}, },
highlight = { highlight = {
-- show a backdrop with hl FlashBackdrop -- show a backdrop with hl FlashBackdrop
backdrop = true, backdrop = true,
-- Highlight the search matches -- Highlight the search matches
matches = false, matches = false,
-- extmark priority -- extmark priority
priority = 5000, priority = 5000,
groups = { groups = {
match = "FlashMatch", match = "FlashMatch",
current = "FlashCurrent", current = "FlashCurrent",
backdrop = "FlashBackdrop", backdrop = "FlashBackdrop",
label = "FlashLabel", label = "FlashLabel",
}, },
}, },
}, },
-- stylua: ignore -- stylua: ignore
keys = { keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, { "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" }, -- { "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", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
}, },
} }

View file

@ -4,22 +4,9 @@ return {
version = false, version = false,
config = function() config = function()
require("mini.icons").setup() require("mini.icons").setup()
require("mini.ai").setup({ n_lines = 500 }) -- require("mini.ai").setup({ n_lines = 500 })
require("mini.trailspace").setup() require("mini.trailspace").setup()
require("mini.cursorword").setup() require("mini.cursorword").setup()
require("mini.surround").setup({ require("mini.ai").setup()
mappings = {
-- add = "wq", -- Add surrounding in Normal and Visual modes
-- delete = "wd", -- Delete surrounding
-- -- find = "sf", -- Find surrounding (to the right)
-- -- find_left = "sF", -- Find surrounding (to the left)
-- highlight = "hs", -- Highlight surrounding
-- replace = "wc", -- Replace surrounding
-- -- update_n_lines = "sn", -- Update `n_lines`
--
-- -- suffix_last = "l", -- Suffix to search with "prev" method
-- -- suffix_next = "n", -- Suffix to search with "next" method
},
})
end, end,
} }