diff options
| -rw-r--r-- | .config/nvim/plugin/50-git.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/.config/nvim/plugin/50-git.lua b/.config/nvim/plugin/50-git.lua index 247dfa3..ee5da46 100644 --- a/.config/nvim/plugin/50-git.lua +++ b/.config/nvim/plugin/50-git.lua @@ -1,7 +1,22 @@ +-- +-- Git-related utilities +-- + vim.pack.add({ "https://github.com/airblade/vim-gitgutter" }) -- Show git status in the gutter local function git_blame(file, line) - vim.cmd(string.format("!git blame --line-porcelain -L %d,%d -- %s", line, line, file)) + local sys = vim.system({ + "bash", + "-c", + string.format('grep -E "^author |^summary " <(git blame -L %d,%d --porcelain -- %s)', line, line, file), + }):wait() + if sys.stdout then + vim.notify(sys.stdout, vim.log.levels.INFO) + end + if sys.code ~= 0 then + local err_msg = "git blame failed (" .. sys.code .. ")\n" .. sys.stderr + vim.notify(err_msg, vim.log.levels.ERROR) + end end vim.api.nvim_create_user_command("GitBlame", function() |
