From 5995ff505c69e381c059f4e0985edb83f890c2ee Mon Sep 17 00:00:00 2001 From: sgoudham Date: Mon, 10 Jul 2023 01:40:13 +0100 Subject: [PATCH] docs(nvim): give reasoning for certain maps --- home/apps/nvim/lua/config/keymaps.lua | 38 +++++++++++++++------------ 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/home/apps/nvim/lua/config/keymaps.lua b/home/apps/nvim/lua/config/keymaps.lua index 447dc06..4660a44 100644 --- a/home/apps/nvim/lua/config/keymaps.lua +++ b/home/apps/nvim/lua/config/keymaps.lua @@ -1,24 +1,10 @@ -- Keymaps are automatically loaded on the VeryLazy event -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here local function unmap(mode, key) vim.keymap.del(mode, key, {}) end -unmap("n", "ww") -unmap("n", "w-") -unmap("n", "w|") -unmap("n", "wd") -unmap("n", "l") -unmap("n", "H") -unmap("n", "L") -unmap("i", "") -unmap("i", "") -require("which-key").register({ - ["w"] = "which_key_ignore", -}) - local function map(mode, lhs, rhs, opts) local keys = require("lazy.core.handler").handlers.keys ---@cast keys LazyKeysHandler @@ -33,14 +19,32 @@ local function map(mode, lhs, rhs, opts) end end +-- Unbind stuff relating to splitting windows +unmap("n", "ww") +unmap("n", "w-") +unmap("n", "w|") +unmap("n", "wd") +require("which-key").register({ + ["w"] = "which_key_ignore", +}) +-- Restore "H" & "L" from neovim +unmap("n", "H") +unmap("n", "L") +-- Unbind moving lines with ALT in INSERT mode +unmap("i", "") +unmap("i", "") +-- Move ":Lazy" from "l" to "cm" +unmap("n", "l") +map("n", "cl", "Lazy", { desc = "Lazy" }) + map("n", "0", "0^", { desc = "which_key_ignore " }) map("n", "", "o", { desc = "which_key_ignore " }) map("n", "", "zz", { desc = "which_key_ignore " }) map("n", "", "zz", { desc = "which_key_ignore " }) -map("n", "w", "w", { desc = "which_key_ignore", nowait = true }) -map("n", "Q", "qa", { desc = "which_key_ignore" }) -map("n", "q", "q", { desc = "which_key_ignore", nowait = true }) +map("n", "w", "w", { desc = "which_key_ignore", nowait = true }) +map("n", "Q", "qa", { desc = "which_key_ignore" }) +map("n", "q", "q", { desc = "which_key_ignore", nowait = true }) -- Clipboard map("n", "y", [["+y]], { desc = "which_key_ignore" })