diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 1abbe376..9f92a4d3 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "12.30.0" + ".": "12.32.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index f7f74112..b148a091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## [12.32.0](https://github.com/LazyVim/LazyVim/compare/v12.31.0...v12.32.0) (2024-07-18) + + +### Features + +* **edgy:** added support for grug-far.nvim ([b1a4740](https://github.com/LazyVim/LazyVim/commit/b1a47405b9fa5eb9f5222876e81be73206b80792)) +* **terminal:** clear search highlight when opening a terminal ([#4090](https://github.com/LazyVim/LazyVim/issues/4090)) ([b5290fd](https://github.com/LazyVim/LazyVim/commit/b5290fd92935d2e96fa2249cfd09bdd853972869)) +* **toggle:** move toggle notifs to toggle function ([c1b76ee](https://github.com/LazyVim/LazyVim/commit/c1b76ee235a2cccff6370ecfca57bdacd5fe6258)) + + +### Bug Fixes + +* **autcmds:** desc for close_with_q ([d6561fd](https://github.com/LazyVim/LazyVim/commit/d6561fd27c17806ca972cbfc18573ca81d13e346)) +* **ui:** another typo ([b8bdebe](https://github.com/LazyVim/LazyVim/commit/b8bdebe5be7eba91db23e43575fc1226075f6a56)) +* **ui:** typo ([4ac249b](https://github.com/LazyVim/LazyVim/commit/4ac249beaae3462d606128ca21db79cb85a8c65b)) + +## [12.31.0](https://github.com/LazyVim/LazyVim/compare/v12.30.0...v12.31.0) (2024-07-17) + + +### Features + +* **keymaps:** proxy leader-w to ctrl-w ([bab5440](https://github.com/LazyVim/LazyVim/commit/bab54406dc312947e4e03bb728498503c09231ca)) +* **R:** added new which-key group for new install feature ([#4078](https://github.com/LazyVim/LazyVim/issues/4078)) ([5339aca](https://github.com/LazyVim/LazyVim/commit/5339acacec0996968d64fdbaf9fe8187bfea1b47)) +* **toggle:** make toggles callable. Fixes [#4081](https://github.com/LazyVim/LazyVim/issues/4081) ([150523b](https://github.com/LazyVim/LazyVim/commit/150523b77b6e848c4135a97a5fd8f6f79a6f4443)) +* **treesitter-context:** which-key toggle ([#4059](https://github.com/LazyVim/LazyVim/issues/4059)) ([ab01350](https://github.com/LazyVim/LazyVim/commit/ab0135093bc18ccf82325bc8ee14c25230a71786)) +* **which-key:** dynamic buffer mappings under leader-b ([8d9f2ad](https://github.com/LazyVim/LazyVim/commit/8d9f2ad97ee0d495135380975438ab8a8ae62b14)) +* **which-key:** dynamic window mappings under leader-w ([66bba78](https://github.com/LazyVim/LazyVim/commit/66bba787b83afdd85b5ee95aa589fbe9fbb95535)) +* **which-key:** leader-w-space starts hydra mode for window mappings ([865bf15](https://github.com/LazyVim/LazyVim/commit/865bf15f1cf4d4f6a3eda6d7509f94a59752fb36)) + ## [12.30.0](https://github.com/LazyVim/LazyVim/compare/v12.29.2...v12.30.0) (2024-07-15) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index cd12fa6e..fcd74ffc 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim Last change: 2024 July 16 +*LazyVim.txt* For Neovim Last change: 2024 July 18 ============================================================================== Table of Contents *LazyVim-table-of-contents* diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index f9a83c82..1440d069 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -71,7 +71,11 @@ vim.api.nvim_create_autocmd("FileType", { }, callback = function(event) vim.bo[event.buf].buflisted = false - vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + vim.keymap.set("n", "q", "close", { + buffer = event.buf, + silent = true, + desc = "Quit buffer", + }) end, }) diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index 08029fc9..a95f519f 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util") ---@class LazyVimConfig: LazyVimOptions local M = {} -M.version = "12.30.0" -- x-release-please-version +M.version = "12.32.0" -- x-release-please-version LazyVim.config = M ---@class LazyVimOptions diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index f568bdac..6468864b 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -174,13 +174,11 @@ map("t", "", "close", { desc = "Hide Terminal" }) map("t", "", "close", { desc = "which_key_ignore" }) -- windows -map("n", "ww", "p", { desc = "Other Window", remap = true }) -map("n", "wd", "c", { desc = "Delete Window", remap = true }) -map("n", "w-", "s", { desc = "Split Window Below", remap = true }) -map("n", "w|", "v", { desc = "Split Window Right", remap = true }) +map("n", "w", "", { desc = "Windows", remap = true }) map("n", "-", "s", { desc = "Split Window Below", remap = true }) map("n", "|", "v", { desc = "Split Window Right", remap = true }) -LazyVim.toggle.map("wm", LazyVim.toggle.maximize) +map("n", "d", "c", { desc = "Delete Window", remap = true }) +LazyVim.toggle.map("m", LazyVim.toggle.maximize) -- tabs map("n", "l", "tablast", { desc = "Last Tab" }) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 5c66966a..a8d512fc 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -47,6 +47,7 @@ vim.g.deprecation_warnings = false vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB -- Show the current document symbols location from Trouble in lualine +-- You can disable this for a buffer by setting `vim.b.trouble_lualine = false` vim.g.trouble_lualine = true local opt = vim.opt diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 00401e61..39108009 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -169,7 +169,13 @@ return { { mode = { "n", "v" }, { "", group = "tabs" }, - { "b", group = "buffer" }, + { + "b", + group = "buffer", + expand = function() + return require("which-key.extras").expand.buf() + end, + }, { "c", group = "code" }, { "f", group = "file/find" }, { "g", group = "git" }, @@ -177,7 +183,14 @@ return { { "q", group = "quit/session" }, { "s", group = "search" }, { "u", group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, - { "w", group = "windows" }, + { + "w", + group = "windows", + proxy = "", + expand = function() + return require("which-key.extras").expand.win() + end, + }, { "x", group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" } }, { "[", group = "prev" }, { "]", group = "next" }, @@ -195,6 +208,13 @@ return { end, desc = "Buffer Keymaps (which-key)", }, + { + "", + function() + require("which-key").show({ keys = "", loop = true }) + end, + desc = "Window Hydra Mode (which-key)", + }, }, config = function(_, opts) local wk = require("which-key") diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index cb2c7358..f63e31ad 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -56,6 +56,9 @@ return { { title = "Neotest Summary", ft = "neotest-summary" }, -- "neo-tree", }, + right = { + { title = "Grug Far", ft = "grug-far", size = { width = 0.4 } }, + }, keys = { -- increase width [""] = function(win) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 14a77ce4..ed17182d 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -198,20 +198,22 @@ return { } -- do not add trouble symbols if aerial is enabled + -- And allow it to be overriden for some buffer types (see autocmds) if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then local trouble = require("trouble") - local symbols = trouble.statusline - and trouble.statusline({ - mode = "symbols", - groups = {}, - title = false, - filter = { range = true }, - format = "{kind_icon}{symbol.name:Normal}", - hl_group = "lualine_c_normal", - }) + local symbols = trouble.statusline({ + mode = "symbols", + groups = {}, + title = false, + filter = { range = true }, + format = "{kind_icon}{symbol.name:Normal}", + hl_group = "lualine_c_normal", + }) table.insert(opts.sections.lualine_c, { symbols and symbols.get, - cond = symbols and symbols.has, + cond = function() + return vim.b.trouble_lualine ~= false and symbols.has() + end, }) end diff --git a/lua/lazyvim/util/terminal.lua b/lua/lazyvim/util/terminal.lua index 598f8ffc..87f8553b 100644 --- a/lua/lazyvim/util/terminal.lua +++ b/lua/lazyvim/util/terminal.lua @@ -87,6 +87,8 @@ function M.open(cmd, opts) vim.cmd.startinsert() end, }) + + vim.cmd("noh") end return terminals[termkey] diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index f7287a7b..c8027666 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -5,21 +5,32 @@ local M = {} ---@field name string ---@field get fun():boolean ---@field set fun(state:boolean) ----@overload fun() -local T = {} -T.__index = T + +---@class lazyvim.Toggle.wrap: lazyvim.Toggle +---@operator call:boolean + +---@param toggle lazyvim.Toggle +function M.wrap(toggle) + return setmetatable(toggle, { + __call = function() + toggle.set(not toggle.get()) + local state = toggle.get() + if state then + LazyVim.info("Enabled " .. toggle.name, { title = toggle.name }) + else + LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name }) + end + return state + end, + }) --[[@as lazyvim.Toggle.wrap]] +end ---@param lhs string ---@param toggle lazyvim.Toggle function M.map(lhs, toggle) + local t = M.wrap(toggle) LazyVim.safe_keymap_set("n", lhs, function() - local state = not toggle.get() - toggle.set(state) - if state then - LazyVim.info("Enabled " .. toggle.name, { title = toggle.name }) - else - LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name }) - end + t() end, { desc = "Toggle " .. toggle.name }) M.wk(lhs, toggle) end @@ -41,8 +52,7 @@ function M.wk(lhs, toggle) }) end ----@type lazyvim.Toggle -M.treesitter = { +M.treesitter = M.wrap({ name = "Treesitter Highlight", get = function() return vim.b.ts_highlight @@ -54,12 +64,11 @@ M.treesitter = { vim.treesitter.stop() end end, -} +}) ---@param buf? boolean function M.format(buf) - ---@type lazyvim.Toggle - local ret = { + return M.wrap({ name = "Auto Format (" .. (buf and "Buffer" or "Global") .. ")", get = function() if not buf then @@ -70,8 +79,7 @@ function M.format(buf) set = function(state) LazyVim.format.enable(state, buf) end, - } - return ret + }) end ---@param opts? {values?: {[1]:any, [2]:any}, name?: string} @@ -80,8 +88,7 @@ function M.option(option, opts) local name = opts.name or option local on = opts.values and opts.values[2] or true local off = opts.values and opts.values[1] or false - ---@type lazyvim.Toggle - local ret = { + return M.wrap({ name = name, get = function() return vim.opt_local[option]:get() == on @@ -89,13 +96,11 @@ function M.option(option, opts) set = function(state) vim.opt_local[option] = state and on or off end, - } - return ret + }) end local nu = { number = true, relativenumber = true } ----@type lazyvim.Toggle -M.number = { +M.number = M.wrap({ name = "Line Numbers", get = function() return vim.opt_local.number:get() or vim.opt_local.relativenumber:get() @@ -110,19 +115,17 @@ M.number = { vim.opt_local.relativenumber = false end end, -} +}) ----@type lazyvim.Toggle -M.diagnostics = { +M.diagnostics = M.wrap({ name = "Diagnostics", get = function() return vim.diagnostic.is_enabled and vim.diagnostic.is_enabled() end, set = vim.diagnostic.enable, -} +}) ----@type lazyvim.Toggle -M.inlay_hints = { +M.inlay_hints = M.wrap({ name = "Inlay Hints", get = function() return vim.lsp.inlay_hint.is_enabled({ bufnr = 0 }) @@ -130,12 +133,11 @@ M.inlay_hints = { set = function(state) vim.lsp.inlay_hint.enable(state, { bufnr = 0 }) end, -} +}) ---@type {k:string, v:any}[] M._maximized = nil ----@type lazyvim.Toggle -M.maximize = { +M.maximize = M.wrap({ name = "Maximize", get = function() return M._maximized ~= nil @@ -170,7 +172,7 @@ M.maximize = { vim.cmd("wincmd =") end end, -} +}) setmetatable(M, { __call = function(m, ...)