Improve descriptions of key-mappings in neovim and align git-shortcuts

I struggle to remember certain shortcuts sometimes. In these cases I
rely on the "whichkey" plugin which shows a short description of for
each possible keystroke in vim. Though I was lazy and didn't maintain
these everywhere, so this change fixes that. Hopefully I can remeber all
the keys better now.

Furthermore this change contains some slight remappings regarding the
git-keymappings. I used fugitive for most of that in the past, but I saw
more potential using telescope in certain cases, especially navigating
the history.
This commit is contained in:
2025-09-14 20:18:35 +02:00
parent a9046ba8bd
commit 2f23034101
4 changed files with 44 additions and 17 deletions

View File

@@ -18,14 +18,29 @@ return {
local ts = require("telescope")
ts.load_extension("fzf")
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<C-p>", builtin.find_files)
vim.keymap.set("n", "<Leader>b", "<CMD>Telescope buffers<CR>")
vim.keymap.set("n", "<Leader>fg", builtin.live_grep)
vim.keymap.set("n", "<Leader>ff", builtin.oldfiles)
vim.keymap.set("n", "<Leader>*", builtin.grep_string)
vim.keymap.set("n", "<Leader>#", builtin.grep_string)
vim.keymap.set("n", "<Leader>lf", builtin.git_bcommits)
vim.keymap.set("n", "<Leader>ld", function () builtin.git_commits({ file_path = true, use_git_root = false }) end)
vim.keymap.set("n", "<Leader>lb", builtin.git_branches)
vim.keymap.set("n", "<C-p>", function ()
builtin.find_files({ hidden = true })
end, { desc = "Find files" })
vim.keymap.set("n", "<Leader>ff", function ()
builtin.find_files({ no_ignore = true, hidden = true })
end, { desc = "Find all files" })
vim.keymap.set("n", "<Leader>fb", function () vim.cmd("Telescope buffers") end, { desc = "Find buffers" })
vim.keymap.set("n", "<Leader>fg", builtin.live_grep, { desc = "Grep files" })
vim.keymap.set("n", "<Leader>fh", builtin.oldfiles, { desc = "Find recent files" })
vim.keymap.set("n", "<Leader>*", builtin.grep_string, { desc = "Find current word" })
vim.keymap.set("n", "<Leader>#", builtin.grep_string, { desc = "Find current word" })
vim.keymap.set("n", "<Leader>gh", function ()
builtin.git_bcommits({
git_command = {"git", "log", "--format=%h %s (%ar) %aN <%aE>", "--abbrev-commit"}
})
end, { desc = "Git history of current file" })
vim.keymap.set("n", "<Leader>glh", function ()
builtin.git_commits({
file_path = true,
use_git_root = false,
git_command = {"git", "log", "--format=%h %s %Cgreen(%ar) %aN <%aE>", "--abbrev-commit", "--", "."}
})
end, { desc = "Git history" })
vim.keymap.set("n", "<Leader>gs", builtin.git_branches, { desc = "Git branches" })
end,
}