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:
@@ -1,13 +1,17 @@
|
|||||||
|
local cmd = function (cmd)
|
||||||
|
return function () vim.cmd(cmd) end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"tpope/vim-fugitive",
|
"tpope/vim-fugitive",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
keys = {
|
keys = {
|
||||||
{ "<Leader>gb", "<Cmd>G blame<CR>", desc = "Git blame" },
|
{ "<Leader>gb", cmd("G blame"), desc = "Git blame" },
|
||||||
{ "<Leader>gll", "<Cmd>G log --graph --format='%h (%ar) %s :: %aN <%aE>'<CR>", desc = "Git log" },
|
{ "<Leader>gll", cmd("G log --graph --format='%h (%ar) %s :: %aN <%aE>'"), desc = "Git log" },
|
||||||
{ "<Leader>glf", "<Cmd>G log --graph --format='%h (%ar) %s :: %aN <%aE>' %<CR>", desc = "Git log for current file" },
|
{ "<Leader>glf", cmd("G log --graph --format='%h (%ar) %s :: %aN <%aE>' %"), desc = "Git log for current file" },
|
||||||
{ "<Leader>glc", "<Cmd>Gclog -- %<CR>", desc = "Quicklist commits affecting the current file" },
|
{ "<Leader>glq", cmd("0Gclog -- %"), desc = "Quicklist revisions of the current file" },
|
||||||
{ "<Leader>glh", "<Cmd>0Gclog -- %<CR>", desc = "Quicklist revisions of the current file" },
|
{ "<Leader>go", cmd("GBrowse"), desc = "Open file in Browser in Remote-Repo"}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- Github integration for :GBrowse
|
-- Github integration for :GBrowse
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ return {
|
|||||||
require('lualine').hide()
|
require('lualine').hide()
|
||||||
vim.cmd([[Goyo]])
|
vim.cmd([[Goyo]])
|
||||||
vim.cmd([[Limelight!! 0.8]])
|
vim.cmd([[Limelight!! 0.8]])
|
||||||
end)
|
end, { desc = "Switch to goyo view" })
|
||||||
end
|
end
|
||||||
-- "pocco81/true-zen.nvim",
|
-- "pocco81/true-zen.nvim",
|
||||||
-- config = function ()
|
-- config = function ()
|
||||||
|
|||||||
@@ -18,14 +18,29 @@ return {
|
|||||||
local ts = require("telescope")
|
local ts = require("telescope")
|
||||||
ts.load_extension("fzf")
|
ts.load_extension("fzf")
|
||||||
local builtin = require("telescope.builtin")
|
local builtin = require("telescope.builtin")
|
||||||
vim.keymap.set("n", "<C-p>", builtin.find_files)
|
vim.keymap.set("n", "<C-p>", function ()
|
||||||
vim.keymap.set("n", "<Leader>b", "<CMD>Telescope buffers<CR>")
|
builtin.find_files({ hidden = true })
|
||||||
vim.keymap.set("n", "<Leader>fg", builtin.live_grep)
|
end, { desc = "Find files" })
|
||||||
vim.keymap.set("n", "<Leader>ff", builtin.oldfiles)
|
vim.keymap.set("n", "<Leader>ff", function ()
|
||||||
vim.keymap.set("n", "<Leader>*", builtin.grep_string)
|
builtin.find_files({ no_ignore = true, hidden = true })
|
||||||
vim.keymap.set("n", "<Leader>#", builtin.grep_string)
|
end, { desc = "Find all files" })
|
||||||
vim.keymap.set("n", "<Leader>lf", builtin.git_bcommits)
|
vim.keymap.set("n", "<Leader>fb", function () vim.cmd("Telescope buffers") end, { desc = "Find buffers" })
|
||||||
vim.keymap.set("n", "<Leader>ld", function () builtin.git_commits({ file_path = true, use_git_root = false }) end)
|
vim.keymap.set("n", "<Leader>fg", builtin.live_grep, { desc = "Grep files" })
|
||||||
vim.keymap.set("n", "<Leader>lb", builtin.git_branches)
|
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,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
|
local cmd = function (cmd)
|
||||||
|
return function () vim.cmd(cmd) end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'Wansmer/treesj',
|
'Wansmer/treesj',
|
||||||
keys = { '<space>m', '<space>j', '<space>s' },
|
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||||
config = function()
|
config = function()
|
||||||
require('treesj').setup({})
|
require('treesj').setup({
|
||||||
|
use_default_keymaps = false,
|
||||||
|
})
|
||||||
|
vim.keymap.set("n", "<Leader>bm", cmd("TSJToggle"), { desc = "Toggle expand/collapse block" })
|
||||||
|
vim.keymap.set("n", "<Leader>bj", cmd("TSJJoin"), { desc = "Collapse block" })
|
||||||
|
vim.keymap.set("n", "<Leader>bs", cmd("TSJSplit"), { desc = "Expand block" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user