diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua
index d773bd5e..28569b91 100644
--- a/lua/lazyvim/config/keymaps.lua
+++ b/lua/lazyvim/config/keymaps.lua
@@ -1,5 +1,7 @@
-- This file is automatically loaded by plugins.config
+local util = require("lazyvim.util")
+
-- Move to window using the movement keys
vim.keymap.set("n", "", "h")
vim.keymap.set("n", "", "j")
@@ -53,20 +55,35 @@ vim.keymap.set({ "i", "v", "n", "s" }, "", "w")
vim.keymap.set("v", "<", "", ">gv")
+-- lazy
+vim.keymap.set("n", "l", ":Lazy")
+
-- new file
vim.keymap.set("n", "fn", "enew", { desc = "New File" })
vim.keymap.set("n", "xl", "lopen", { desc = "Open Location List" })
vim.keymap.set("n", "xq", "copen", { desc = "Open Quickfix List" })
+-- toggle options
+vim.keymap.set("n", "tf", require("lazyvim.plugins.lsp.format").toggle, { desc = "Format on Save" })
+vim.keymap.set("n", "ts", function()
+ util.toggle("spell")
+end, { desc = "Spelling" })
+vim.keymap.set("n", "tw", function()
+ util.toggle("wrap")
+end, { desc = "Word Wrap" })
+vim.keymap.set("n", "tn", function()
+ util.toggle("relativenumber", true)
+ util.toggle("number")
+end, { desc = "Line Numbers" })
+
-- lazygit
vim.keymap.set("n", "gg", function()
require("lazyvim.util").float_term({ "lazygit" })
-end, { desc = "Lazygit for cwd" })
+end, { desc = "Lazygit (cwd)" })
vim.keymap.set("n", "gG", function()
- local util = require("lazyvim.util")
util.float_term({ "lazygit" }, { cwd = util.get_root() })
-end, { desc = "Lazygit for root dir" })
+end, { desc = "Lazygit (root dir)" })
-- quit
vim.keymap.set("n", "qq", "qa", { desc = "Quit all" })
diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua
index 000d55c9..7078f72d 100644
--- a/lua/lazyvim/plugins/editor.lua
+++ b/lua/lazyvim/plugins/editor.lua
@@ -12,8 +12,9 @@ return {
function()
require("neo-tree.command").execute({ toggle = true, dir = require("lazyvim.util").get_root() })
end,
- desc = "NeoTree",
+ desc = "NeoTree (root dir)",
},
+ { "fT", "Neotree toggle", desc = "NeoTree (cwd)" },
},
init = function()
vim.g.neo_tree_remove_legacy_commands = 1
@@ -41,9 +42,10 @@ return {
cmd = "Telescope",
keys = {
{ "/", util.telescope("live_grep"), desc = "Find in Files (Grep)" },
- { "", util.telescope("find_files"), desc = "Find Files" },
+ { "", util.telescope("find_files"), desc = "Find Files (root dir)" },
{ "fb", "Telescope buffers", desc = "Buffers" },
- { "ff", util.telescope("find_files"), desc = "Find Files" },
+ { "ff", util.telescope("find_files"), desc = "Find Files (root dir)" },
+ { "fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" },
{ "fr", "Telescope oldfiles", desc = "Recent" },
{ "gc", "Telescope git_commits", desc = "commits" },
{ "gs", "Telescope git_status", desc = "status" },
@@ -58,7 +60,8 @@ return {
{ "ht", "Telescope builtin", desc = "Telescope" },
{ "sb", "Telescope current_buffer_fuzzy_find", desc = "Buffer" },
{ "sc", "Telescope command_history", desc = "Command History" },
- { "sg", util.telescope("live_grep"), desc = "Grep" },
+ { "sg", util.telescope("live_grep"), desc = "Grep (root dir)" },
+ { "sG", util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
{ "sm", "Telescope marks", desc = "Jump to Mark" },
{ ",", "Telescope buffers show_all_buffers=true", desc = "Switch Buffer" },
{ ":", "Telescope command_history", desc = "Command History" },
@@ -125,7 +128,6 @@ return {
config = function()
local wk = require("which-key")
wk.setup({
- show_help = false,
plugins = { spelling = true },
key_labels = { [""] = "SPC" },
})
@@ -193,7 +195,8 @@ return {
cmd = { "TroubleToggle", "Trouble" },
config = { use_diagnostic_signs = true },
keys = {
- { "xx", "TroubleToggle workspace_diagnostics", desc = "Trouble" },
+ { "xx", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" },
+ { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" },
},
},
@@ -207,7 +210,7 @@ return {
keys = {
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" },
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" },
- { "xt", "TodoTrouble", "Todo Trouble" },
+ { "xt", "TodoTrouble", desc = "Todo Trouble" },
{ "xtt", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo Trouble" },
{ "xT", "TodoTelescope", desc = "Todo Telescope" },
},
diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua
index 8d69ac3c..29840f57 100644
--- a/lua/lazyvim/plugins/ui.lua
+++ b/lua/lazyvim/plugins/ui.lua
@@ -126,6 +126,15 @@ return {
long_message_to_split = true,
},
},
+ -- stylua: ignore
+ keys = {
+ { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" },
+ { "nl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
+ { "nh", function() require("noice").cmd("history") end, desc = "Noice History" },
+ { "na", function() require("noice").cmd("all") end, desc = "Noice All" },
+ { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true },
+ { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true },
+ },
},
-- dashboard
diff --git a/lua/lazyvim/util.lua b/lua/lazyvim/util.lua
index d7e44835..0be65a4a 100644
--- a/lua/lazyvim/util.lua
+++ b/lua/lazyvim/util.lua
@@ -73,4 +73,16 @@ function M.float_term(cmd, opts)
require("lazy.util").open_cmd(cmd, opts)
end
+---@param silent boolean?
+function M.toggle(option, silent)
+ vim.opt_local[option] = not vim.opt_local[option]:get()
+ if not silent then
+ vim.notify(
+ (vim.opt_local[option]:get() and "Enabled" or "Disabled") .. option,
+ vim.log.levels.INFO,
+ { title = "Option" }
+ )
+ end
+end
+
return M