From 676c04735802ae1da7efa672eaf692ccc19937f7 Mon Sep 17 00:00:00 2001 From: Huck Boles Date: Sat, 13 May 2023 15:50:17 -0500 Subject: [PATCH] more key maps --- lua/map.lua | 30 ++++++++++++++++-------------- lua/plugins.lua | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lua/map.lua b/lua/map.lua index 703d284..d0de5de 100644 --- a/lua/map.lua +++ b/lua/map.lua @@ -1,21 +1,12 @@ --- quick creation for splits, tabs, buffers +-- quick splits, tabs, buffers vim.keymap.set('n', 'h', ":vsplit ") vim.keymap.set('n', 'v', ":split ") vim.keymap.set('n', 't', ':tabnew ') vim.keymap.set('n', '', 'bprev') --- move through virtual lines +-- movement enhancers vim.keymap.set('n', 'j', 'gj') vim.keymap.set('n', 'k', 'gk') - --- move visual selections -vim.keymap.set('v', 'J', ":m '>+1gv=gv") -vim.keymap.set('v', 'K', ":m '<-2gv=gv") - --- quick redo last macro -vim.keymap.set('n', 'Q', '@@') - --- center the screen for movement commands vim.keymap.set('n', 'w', 'za') vim.keymap.set('n', 'n', 'nzz') vim.keymap.set('n', 'N', 'Nzz') @@ -24,12 +15,21 @@ vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') --- normal mode line splitting and joining +-- quick redo last macro +vim.keymap.set('n', 'Q', '@@') + +-- replace word thats under cursor +vim.keymap.set('n', 's', [[:%s/\<\>//gI]]) + +-- better line editing +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") vim.keymap.set('n', 'H', 'izzO') +vim.keymap.set('n', 'J', 'mzJ`z') vim.keymap.set('n', 'L', 'izzi') vim.keymap.set('n', 'K', 'Jx') --- quick plugin editing +-- quick config editing vim.keymap.set('n', '=', 'tabnew ~/.config/nvim/init.lua') vim.keymap.set('n', 'q', 'Lazy') @@ -44,6 +44,7 @@ vim.keymap.set('n', 'r', vim.lsp.buf.rename) vim.keymap.set('n', 'k', vim.lsp.buf.hover) vim.keymap.set('n', 'K', vim.diagnostic.open_float) +-- toggle lsp diagnostics vim.keymap.set('n', 'd', function() if vim.g.visible_diagnostics then @@ -56,7 +57,7 @@ vim.keymap.set('n', 'd', end ) --- live grep in git repo, or fall back to current repo +-- live grep in git repo, or fall back to current directory vim.keymap.set('n', 'F', function() local function is_git_repo() @@ -82,6 +83,7 @@ vim.keymap.set('n', 'F', end ) +-- fuzzy search over git files, or fall back to all files vim.keymap.set('n', 'f', function() local function is_git_repo() diff --git a/lua/plugins.lua b/lua/plugins.lua index a07bc7a..dcc14c0 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -22,6 +22,7 @@ return { { 'ga', 'Git add %' }, { 'gd', 'Gdiffsplit' }, { 'gb', 'Git blame' }, + { 'gp', 'Git push' }, }, }, -- 2.45.2