From 5c2bdaa0fafb10cf88aa85d6a68fa2955dcf36b3 Mon Sep 17 00:00:00 2001 From: Milton Montero Date: Fri, 13 Jan 2023 16:35:24 +0000 Subject: [PATCH] Add register preserving mappings and change diagnostics to 'i'. --- lua/keymaps.lua | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 0551e26..d6db68d 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -6,7 +6,7 @@ local Utils = require('utils') -- local exprnnoremap = Utils.exprnnoremap local nnoremap = Utils.nnoremap local vnoremap = Utils.vnoremap --- local xnoremap = Utils.xnoremap +local xnoremap = Utils.xnoremap local inoremap = Utils.inoremap -- local tnoremap = Utils.tnoremap -- local nmap = Utils.nmap @@ -57,13 +57,20 @@ nnoremap("", ":bd") -- Yank to end of line nnoremap("Y", "y$") +-- Paste into selection without overwriting p register +xnoremap("p", '\"_dP') + +-- Delete without overwriting register +nnoremap("d", '\"_d') +vnoremap("d", '\"_d') + -- Copy to system clippboard nnoremap("y", '"+y') vnoremap("y", '"+y') -- Paste from system clippboard -nnoremap("", '"+p') -vnoremap("", '"+p') +nnoremap("P", '"+p') +vnoremap("P", '"+p') -- Clear highlight search nnoremap("nh", ":nohlsearch") @@ -86,22 +93,22 @@ nnoremap("xo", " !xdg-open %") -- Fugitive nnoremap("G", ":G") -nnoremap("gh", ":Gclog") +nnoremap("gl", ":Gclog") -- Show line diagnostics -nnoremap("d", 'lua vim.diagnostic.open_float(0, {scope = "line"})') +nnoremap("i", 'lua vim.diagnostic.open_float(0, {scope = "line"})') -- Open local diagnostics in local list -nnoremap("D", "lua vim.diagnostic.setloclist()") +nnoremap("I", "lua vim.diagnostic.setloclist()") -- Open all project diagnostics in quickfix list -nnoremap("", "lua vim.diagnostic.setqflist()") +nnoremap("", "lua vim.diagnostic.setqflist()") -- Telescope -nnoremap("ff", "Telescope find_files") -nnoremap("fhf","Telescope find_files hidden=true") -nnoremap("fb", "Telescope buffers") -nnoremap("fg", "Telescope live_grep") +nnoremap("o", "Telescope find_files") +nnoremap("H", "Telescope find_files hidden=true") +nnoremap("b", "Telescope buffers") +nnoremap("lg", "Telescope live_grep") -- File explorer nnoremap("e", "NvimTreeToggle") -- NvimTree