From ebd2e1259aa046e46bf79abc280967abfa0c9b42 Mon Sep 17 00:00:00 2001 From: sam rolfe Date: Thu, 9 Oct 2025 11:12:41 +1100 Subject: [PATCH] Change kep mappings in lua --- nvim/lua/current-theme.lua | 2 +- nvim/lua/sam/options.lua | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/nvim/lua/current-theme.lua b/nvim/lua/current-theme.lua index 3198fc4..c74694d 100644 --- a/nvim/lua/current-theme.lua +++ b/nvim/lua/current-theme.lua @@ -1 +1 @@ -vim.cmd("colorscheme catppuccin") \ No newline at end of file +vim.cmd("colorscheme kanagawa-wave") \ No newline at end of file diff --git a/nvim/lua/sam/options.lua b/nvim/lua/sam/options.lua index b21d728..e927ce1 100644 --- a/nvim/lua/sam/options.lua +++ b/nvim/lua/sam/options.lua @@ -5,3 +5,47 @@ vim.g.maplocalleader = " " -- Set the local leader key to the space bar. -- sam.options.lua vim.opt.number = true -- Absolute numbers on all lines vim.opt.relativenumber = true -- Relative numbers (hybrid when both enabled) + +-- =================================================================== +-- Essential Keybindings +-- =================================================================== + +-- Set a timeout for which-key to respond (in milliseconds) +vim.opt.timeoutlen = 300 + +-- A helper function to make setting keymaps easier +local keymap = function(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +-- --- General --- +-- Save the current file +keymap("n", "w", ":w", { desc = "Write (Save) File" }) + +-- Quit the current buffer/window +keymap("n", "q", ":q", { desc = "Quit Window" }) + +-- --- Window Management (Splits) --- +-- Split window vertically +keymap("n", "sv", "v", { desc = "Split Vertically" }) + +-- Split window horizontally +keymap("n", "sh", "s", { desc = "Split Horizontally" }) + +-- --- Navigation Between Splits --- +-- Move to the window below/above/left/right +keymap("n", "", "j", { desc = "Move to Window Below" }) +keymap("n", "", "k", { desc = "Move to Window Above" }) +keymap("n", "", "h", { desc = "Move to Window Left" }) +keymap("n", "", "l", { desc = "Move to Window Right" }) + +-- --- Buffer Navigation --- +-- Go to the next buffer +keymap("n", "", ":bnext", { desc = "Next Buffer" }) + +-- Go to the previous buffer +keymap("n", "", ":bprevious", { desc = "Previous Buffer" })