Change kep mappings in lua
This commit is contained in:
@ -1 +1 @@
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
vim.cmd("colorscheme kanagawa-wave")
|
||||
@ -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", "<leader>w", ":w<CR>", { desc = "Write (Save) File" })
|
||||
|
||||
-- Quit the current buffer/window
|
||||
keymap("n", "<leader>q", ":q<CR>", { desc = "Quit Window" })
|
||||
|
||||
-- --- Window Management (Splits) ---
|
||||
-- Split window vertically
|
||||
keymap("n", "<leader>sv", "<C-w>v", { desc = "Split Vertically" })
|
||||
|
||||
-- Split window horizontally
|
||||
keymap("n", "<leader>sh", "<C-w>s", { desc = "Split Horizontally" })
|
||||
|
||||
-- --- Navigation Between Splits ---
|
||||
-- Move to the window below/above/left/right
|
||||
keymap("n", "<C-j>", "<C-w>j", { desc = "Move to Window Below" })
|
||||
keymap("n", "<C-k>", "<C-w>k", { desc = "Move to Window Above" })
|
||||
keymap("n", "<C-h>", "<C-w>h", { desc = "Move to Window Left" })
|
||||
keymap("n", "<C-l>", "<C-w>l", { desc = "Move to Window Right" })
|
||||
|
||||
-- --- Buffer Navigation ---
|
||||
-- Go to the next buffer
|
||||
keymap("n", "<S-l>", ":bnext<CR>", { desc = "Next Buffer" })
|
||||
|
||||
-- Go to the previous buffer
|
||||
keymap("n", "<S-h>", ":bprevious<CR>", { desc = "Previous Buffer" })
|
||||
|
||||
Reference in New Issue
Block a user