diff --git a/CHEATSHEET.md b/CHEATSHEET.md index f020601..9e235b5 100644 --- a/CHEATSHEET.md +++ b/CHEATSHEET.md @@ -1,14 +1,15 @@ # Neovim cheat sheet +Heavily customized. Related blog post: https://lugh.ch/neovim-lessons-learned.html + ## BASICS - `:checkhealth []` check base or plugin status - `:checkhealth vim.lsp` show details of LSP attached to buffer - `:verbose set expandtab?` check where `expandtab` has been set last -- `:Lazy` show package manager UI -- `:Mason` show Mason UI +- `:Lazy` show package manager TUI +- `:Mason` show LSP management TUI - `:TSUpdate` update all Tree-sitter parsers -- `:LspInfo` show attached LSP client details - `:ConformInfo` useful to debug why a formatter times out ## NAVIGATING @@ -27,19 +28,19 @@ ## Buffers - `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 ## Text -- `w/e` move to **start/end of next word** (ignores punctuation due to remap) -- `b` move to **start of previous word** (ignores punctuation due to remap) +- `w/e` move to **start/end of next word** +- `b` move to **start of previous word** - `Ctrl`+`0` start of line - `Ctrl`+`$` end of line - `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`+`i` jump back to location you were before (after using `Ctrl`+`o`) -- `s` highlight jump targets via `flash.nvim` +- `s` highlight jump targets w/ `flash.nvim` ## LSP, Code & Diagnostics @@ -92,6 +93,8 @@ - `:windo diffthis` open `vimdiff` for open splits - `:vert diffsplit ` diff this file and `` - `:windo diffoff` to close diff view +- `ciq` change inside quotes w/ `mini.ai` +- `caq` change around quotes w/ `mini.ai` ## SELECTING diff --git a/CHEATSHEET.pdf b/CHEATSHEET.pdf index efe87a5..ebfa14b 100644 Binary files a/CHEATSHEET.pdf and b/CHEATSHEET.pdf differ diff --git a/lua/weeheavy/plugins/flash.lua b/lua/weeheavy/plugins/flash.lua index 13bb3ce..3b84219 100644 --- a/lua/weeheavy/plugins/flash.lua +++ b/lua/weeheavy/plugins/flash.lua @@ -1,59 +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" }, - }, + "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 index fde12fc..3bb5d20 100644 --- a/lua/weeheavy/plugins/mini.lua +++ b/lua/weeheavy/plugins/mini.lua @@ -4,22 +4,9 @@ return { version = false, config = function() require("mini.icons").setup() - require("mini.ai").setup({ n_lines = 500 }) + -- require("mini.ai").setup({ n_lines = 500 }) require("mini.trailspace").setup() require("mini.cursorword").setup() - require("mini.surround").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 - }, - }) + require("mini.ai").setup() end, }