Updated config
This commit is contained in:
66
.config/nvim/lua/keys.lua
Normal file
66
.config/nvim/lua/keys.lua
Normal file
@ -0,0 +1,66 @@
|
||||
local function map(mode, lhs, rhs, info)
|
||||
vim.keymap.set(mode, lhs, rhs, { desc = info })
|
||||
end
|
||||
|
||||
-- Basics
|
||||
map("n", ";", ":", "Command mode")
|
||||
map("n", "U", "<cmd>redo<cr>", "Redo")
|
||||
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
|
||||
map({"n", "v"}, "qq", "<cmd>qa!<cr>", "Quit all")
|
||||
|
||||
-- Editing lines
|
||||
map({ "n", "v" }, "<C-b>", "^", "Beginning of line")
|
||||
map("i", "<C-b>", "<esc>^i", "Beginning of line")
|
||||
map({ "i", "n", "v" }, "<C-e>", "<end>", "End of line")
|
||||
map("n", "<C-l>", "^Da", "Rewrite line")
|
||||
map("i", "<C-l>", "<esc>^Da", "Rewrite line")
|
||||
map("v", "<C-l>", "V", "Select line")
|
||||
map({"n", "v"}, "<C-a>", "<esc>ggVG", "Select all")
|
||||
|
||||
-- Editing multiple instances
|
||||
map("n", "<f3>", "*#", "Search word under cursor")
|
||||
map("v", "<f3>", "y/<C-r>\"<cr>N", "Search selection")
|
||||
map("n", "<C-d>", "viw", "Select word under cursor")
|
||||
map("v", "<C-d>", "y/<C-r>\"<cr>N", "Search selection")
|
||||
map("n", "<C-r>", "*#:%s//<C-r><C-w>/g<left><left>", "Replace word under cursor")
|
||||
map("v", "<C-r>", "y/<C-r>\"<cr>N:%s//<C-r>\"/g<left><left>", "Replace selection")
|
||||
|
||||
-- Increasing and decreasing numbers
|
||||
map("n", "+", "<C-a>", "Increase number")
|
||||
map("n", "-", "<C-x>", "Decrease number")
|
||||
map("n", "<kPlus>", "<C-a>", "Increase number")
|
||||
map("n", "<kMinus>", "<C-x>", "Decrease number")
|
||||
|
||||
-- Buffer management
|
||||
map("n", "<C-n>", "<cmd>enew<cr>", "New file")
|
||||
map({ "i", "n", "s", "v" }, "<C-s>", "<cmd>w<cr><esc>", "Save file")
|
||||
map("n", "<C-q>", "<cmd>bd<cr>", "Delete buffer")
|
||||
|
||||
-- Copy and paste
|
||||
map("v", "<C-c>", "y")
|
||||
map("n", "<C-v>", '"+p')
|
||||
|
||||
-- Indenting
|
||||
map("n", "<Tab>", "V>gv<esc>")
|
||||
map("n", "<S-Tab>", "V<gv<esc>")
|
||||
map("v", "<Tab>", ">gv")
|
||||
map("v", "<S-Tab>", "<gv")
|
||||
|
||||
-- Shift arrow selection
|
||||
map("n", "<S-Up>", "v<Up>")
|
||||
map("n", "<S-Down>", "v<Down>")
|
||||
map("n", "<S-Left>", "v<Left>")
|
||||
map("n", "<S-Right>", "v<Right>")
|
||||
|
||||
map("v", "<S-Up>", "<Up>")
|
||||
map("v", "<S-Down>", "<Down>")
|
||||
map("v", "<S-Left>", "<Left>")
|
||||
map("v", "<S-Right>", "<Right>")
|
||||
|
||||
map("i", "<S-Up>", "<Esc>v<Up>")
|
||||
map("i", "<S-Down>", "<Esc>v<Down>")
|
||||
map("i", "<S-Left>", "<Esc>v<Left>")
|
||||
map("i", "<S-Right>", "<Esc>v<Right>")
|
||||
|
||||
-- Package manager
|
||||
map("n", "<leader>l", "<cmd>Lazy<cr>", "Lazy")
|
Reference in New Issue
Block a user