From 4924454d0a906ec45d782d0c307e1ae8f7b8d981 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Wed, 17 Apr 2024 22:15:13 -0400 Subject: [PATCH] Cleaning up WhichKey hints --- after/plugin/git_stuff.lua | 22 +++++++++++----------- after/plugin/telescope.lua | 8 ++++---- after/plugin/undotree.lua | 2 +- after/plugin/whichkey.lua | 8 ++++++++ lua/pippy/init.lua | 2 +- 5 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 after/plugin/whichkey.lua diff --git a/after/plugin/git_stuff.lua b/after/plugin/git_stuff.lua index bed8592..9f3bed2 100644 --- a/after/plugin/git_stuff.lua +++ b/after/plugin/git_stuff.lua @@ -33,16 +33,16 @@ require('gitsigns').setup{ end) -- Actions - map('n', 'hs', gitsigns.stage_hunk) - map('n', 'hr', gitsigns.reset_hunk) - map('n', 'hS', gitsigns.stage_buffer) - map('n', 'hu', gitsigns.undo_stage_hunk) - map('n', 'hR', gitsigns.reset_buffer) - map('n', 'hp', gitsigns.preview_hunk) - map('n', 'hb', function() gitsigns.blame_line{full=true} end) - map('n', 'tb', gitsigns.toggle_current_line_blame) - map('n', 'hd', gitsigns.diffthis) - map('n', 'hD', function() gitsigns.diffthis('~') end) - map('n', 'td', gitsigns.toggle_deleted) + map('n', 'hs', gitsigns.stage_hunk, { desc = 'stage hunk') + map('n', 'hr', gitsigns.reset_hunk, 'reset hunk') + map('n', 'hS', gitsigns.stage_buffer, 'stage buffer') + map('n', 'hu', gitsigns.undo_stage_hunk, 'undo stage hunk') + map('n', 'hR', gitsigns.reset_buffer, 'reset buffer') + map('n', 'hp', gitsigns.preview_hunk, 'preview hunk') + map('n', 'hb', function() gitsigns.blame_line{full=true} end, 'hunk blame') + map('n', 'tb', gitsigns.toggle_current_line_blame, 'toggle single line blame') + map('n', 'hd', gitsigns.diffthis, 'hunk diff') + map('n', 'hD', function() gitsigns.diffthis('~') end, 'diff deleted') + map('n', 'td', gitsigns.toggle_deleted, 'toggle deleted') end } diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index afb984a..1cc19ee 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,5 +1,5 @@ local builtin = require('telescope.builtin') -vim.keymap.set('n', 'ff', builtin.find_files, {}) -vim.keymap.set('n', 'fg', builtin.live_grep, {}) -vim.keymap.set('n', 'fs', builtin.grep_string, {}) -vim.keymap.set('n', 'fh', builtin.help_tags, {}) +vim.keymap.set('n', 'ff', builtin.find_files, { desc = "Find files" }) +vim.keymap.set('n', 'fg', builtin.live_grep, { desc = "Find in live grep" }) +vim.keymap.set('n', 'fs', builtin.grep_string, { desc = "Find string" }) +vim.keymap.set('n', 'fh', builtin.help_tags, { desc = "Find from help" }) diff --git a/after/plugin/undotree.lua b/after/plugin/undotree.lua index b6b9276..26a24c7 100644 --- a/after/plugin/undotree.lua +++ b/after/plugin/undotree.lua @@ -1 +1 @@ -vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) +vim.keymap.set("n", "tu", vim.cmd.UndotreeToggle, { desc = 'Toggle undo tree' }) diff --git a/after/plugin/whichkey.lua b/after/plugin/whichkey.lua new file mode 100644 index 0000000..f1e9427 --- /dev/null +++ b/after/plugin/whichkey.lua @@ -0,0 +1,8 @@ +-- Document existing key chains +require('which-key').register { + ['f'] = { name = '[F]ind', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, + ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, +} diff --git a/lua/pippy/init.lua b/lua/pippy/init.lua index 97e00ee..259a9c4 100644 --- a/lua/pippy/init.lua +++ b/lua/pippy/init.lua @@ -13,7 +13,7 @@ vim.opt.swapfile = false vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" vim.opt.undofile = true -vim.opt.hlsearch = false +vim.opt.hlsearch = true vim.opt.incsearch = true vim.opt.termguicolors = true