Adding whichkey

This commit is contained in:
Andy Teijelo 2022-11-09 21:55:49 -05:00
parent 4f20c382f4
commit 52335f09c0
4 changed files with 27 additions and 7 deletions

View file

@ -25,3 +25,4 @@ require "user.dap"
require "user.exrc" require "user.exrc"
require "user.fidget" require "user.fidget"
require "user.whichkey"

View file

@ -33,11 +33,11 @@ gitsigns.setup {
row = 0, row = 0,
col = 1, col = 1,
}, },
on_attach = function (bufnr) -- on_attach = function (bufnr)
local gs = package.loaded.gitsigns -- local gs = package.loaded.gitsigns
local opts = { buffer=bufnr, silent=true } -- local opts = { buffer=bufnr, silent=true }
vim.keymap.set('n', '<Leader>hp', gs.preview_hunk, opts) -- vim.keymap.set('n', '<Leader>hp', gs.preview_hunk, opts)
vim.keymap.set('n', '<Leader>hb', function() gs.blame_line{full=false} end, opts) -- vim.keymap.set('n', '<Leader>hb', function() gs.blame_line{full=false} end, opts)
vim.keymap.set('n', '<Leader>hB', function() gs.blame_line{full=true} end, opts) -- vim.keymap.set('n', '<Leader>hB', function() gs.blame_line{full=true} end, opts)
end -- end
} }

View file

@ -123,3 +123,21 @@ keymap("i", "<M-l>", "<Right>", opts)
keymap("i", "<M-h>", "<Left>", opts) keymap("i", "<M-h>", "<Left>", opts)
keymap("i", "<M-j>", "<C-o>gj", opts) keymap("i", "<M-j>", "<C-o>gj", opts)
keymap("i", "<M-k>", "<C-o>gk", opts) keymap("i", "<M-k>", "<C-o>gk", opts)
-- gitsigns
-- vim.keymap.set('n', '<Leader>hp', '<cmd>Gitsigns preview_hunk<cr>', opts)
-- vim.keymap.set('n', '<Leader>hb', function() gs.blame_line{full=false} end, opts)
-- vim.keymap.set('n', '<Leader>hB', function() gs.blame_line{full=true} end, opts)
local wk = require("which-key")
local gs = require("gitsigns")
wk.register({
g = {
name = "gitsigns",
p = { "<cmd>Gitsigns preview_hunk<cr>", "Preview hunk" },
b = { function() gs.blame_line{full=false} end, "Blame line (short)" },
B = { function() gs.blame_line{full=true} end, "Blame line (full)" }
},
prefix = "<leader>"
})

View file

@ -117,6 +117,7 @@ return packer.startup(function(use)
use { "mg979/vim-visual-multi" } use { "mg979/vim-visual-multi" }
use { 'vala-lang/vala.vim' } use { 'vala-lang/vala.vim' }
use { 'folke/which-key.nvim' }
-- Automatically set up your configuration after cloning packer.nvim -- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins -- Put this at the end after all plugins