From fc68b611fefcee24f9eb1f4fc12b32c3dda08364 Mon Sep 17 00:00:00 2001 From: Job79 Date: Wed, 6 Nov 2024 20:03:57 +0100 Subject: [PATCH] feat: add some custom keymaps --- Containerfile | 2 +- config/nvim/config/keymaps.lua | 23 +++++++++++++++++++++++ config/nvim/config/options.lua | 2 -- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 config/nvim/config/keymaps.lua delete mode 100644 config/nvim/config/options.lua diff --git a/Containerfile b/Containerfile index 2b88323..92cd881 100644 --- a/Containerfile +++ b/Containerfile @@ -15,7 +15,7 @@ COPY config/user/profile /home/user/.bash_profile # === setup neovim === RUN git clone --depth 1 https://github.com/LazyVim/starter ~/.config/nvim COPY --chown=user:user config/nvim/plugins /home/user/.config/nvim/lua/plugins -COPY --chown=user:user config/nvim/config/options.lua /home/user/.config/nvim/lua/config/options.lua +COPY --chown=user:user config/nvim/config/keymaps.lua /home/user/.config/nvim/lua/config/keymaps.lua COPY --chown=user:user config/nvim/lazyvim.json /home/user/.config/nvim/lazyvim.json # === setup container === diff --git a/config/nvim/config/keymaps.lua b/config/nvim/config/keymaps.lua new file mode 100644 index 0000000..ef2462a --- /dev/null +++ b/config/nvim/config/keymaps.lua @@ -0,0 +1,23 @@ +-- 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 keymap = vim.keymap.set +local delkeymap = vim.keymap.del +local opts = { noremap = true, silent = true } + +-- Better line start/end +keymap("n", "H", "^", opts) +keymap("n", "L", "$", opts) +keymap("v", "H", "^", opts) +keymap("v", "L", "$", opts) + +-- Better escape +keymap("n", "", "s:noh", opts) + +-- Disable alt j/k to move lines +delkeymap({ "i", "v" }, "") +delkeymap({ "i", "v" }, "") + +-- Better + movement +keymap("n", "", "zz", opts) +keymap("n", "", "zz", opts) diff --git a/config/nvim/config/options.lua b/config/nvim/config/options.lua deleted file mode 100644 index 982f168..0000000 --- a/config/nvim/config/options.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.keymap.set("n", "", "zz", { desc = "Center cursor after moving down half-page" }) -vim.keymap.set("n", "", "zz", { desc = "Center cursor after moving up half-page" })