42 lines
1.2 KiB
Lua
42 lines
1.2 KiB
Lua
-- 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
|
|
|
|
-- copied from LazyVim
|
|
local function map(mode, lhs, rhs, opts)
|
|
local keys = require("lazy.core.handler").handlers.keys
|
|
---@cast keys LazyKeysHandler
|
|
-- do not create the keymap if a lazy keys handler exists
|
|
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
|
opts = opts or {}
|
|
opts.silent = opts.silent ~= false
|
|
if opts.remap and not vim.g.vscode then
|
|
opts.remap = nil
|
|
end
|
|
vim.keymap.set(mode, lhs, rhs, opts)
|
|
end
|
|
end
|
|
|
|
-- I fatfinger these often, but i'm not using their functionality. Just NOP them
|
|
map("n", "Q", "<nop>")
|
|
map("n", "@", "<nop>")
|
|
|
|
-- move when highlighted
|
|
map("v", "J", ":m '>+1<CR>gv=gv")
|
|
map("v", "K", ":m '<-2<CR>gv=gv")
|
|
|
|
-- keep cursor in the middle while jumping
|
|
map("n", "<C-d>", "<C-d>zz")
|
|
map("n", "<C-u>", "<C-u>zz")
|
|
map("n", "n", "nzzzv")
|
|
map("n", "N", "Nzzzv")
|
|
|
|
-- delete to void bindings
|
|
map("n", "<leader>d", '"_d')
|
|
map("v", "<leader>d", '"_d')
|
|
|
|
-- yank and paste to system clipboard
|
|
map("n", "<leader>y", '"+y')
|
|
map("v", "<leader>y", '"+y')
|
|
map("n", "<leader>Y", '"+Y')
|