From 23706b799a64d4e6e2f8f6a74ab6c95644ec5b1d Mon Sep 17 00:00:00 2001 From: Sloane Perrault Date: Mon, 19 Sep 2022 08:01:46 -0400 Subject: [PATCH] update some neovim keys --- .config/nvim/lua/keys.lua | 40 ++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/.config/nvim/lua/keys.lua b/.config/nvim/lua/keys.lua index e87c7f8..d3df166 100644 --- a/.config/nvim/lua/keys.lua +++ b/.config/nvim/lua/keys.lua @@ -1,6 +1,13 @@ local wk = require('which-key') local map = vim.keymap.set +vim.cmd([[ + augroup keys_user_config + autocmd! + autocmd BufWritePost keys.lua source + augroup end +]]) + wk.setup({ key_labels = { [''] = 'SPC', @@ -13,9 +20,21 @@ vim.opt.timeoutlen = 500 vim.g.mapleader = ' ' +-- Handy to remap semi-colon to colon map({ 'n', 'v' }, ';', ':') map({ 'n', 'v' }, 'q;', 'q:') +-- System clipboard via -> y | p +map({ 'n', 'v' }, 'y', '"+y') +map( 'n', 'Y', '"+Y') +map({ 'n', 'v' }, 'p', '"+p') +map({ 'n', 'v' }, 'P', '"+P') + +-- Common short-hands +map('n', 'w', 'w') +map('n', 'q', 'q') +map('n', 'o', 'only') + wk.register({ [''] = { 'Telescope find_files', 'File file in project' }, ['/'] = { 'Telescope live_grep', 'Search project' }, @@ -31,12 +50,6 @@ wk.register({ r = { 'Telescope oldfiles', 'Recent files' }, }, - q = { - name = 'quit/session', - b = { 'q', 'Buffer' }, - q = { 'qa', 'Neovim' }, - }, - e = { name = 'editor', p = { @@ -45,5 +58,18 @@ wk.register({ c = { 'PackerCompile', 'Packer Compile' }, l = { 'PackerClean', 'Packer Clean' }, } - } + }, + + g = { + name = 'git', + s = { 'Git', 'Status' }, + f = { 'Git fetch', 'Fetch' }, + p = { 'Git push --force-with-lease -u origin head', 'Push' }, + r = { + name = 'rebase', + m = { 'Git rebase origin/main', 'origin/main' }, + M = { 'Git rebase --interactive origin/main', 'Interactive origin/main' } + } + }, + }, { prefix = '' })