-- -- Git-related utilities -- vim.pack.add({ "https://github.com/airblade/vim-gitgutter" }) -- Show git status in the gutter local function git_blame(file, line) 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() git_blame(vim.api.nvim_buf_get_name(0), vim.api.nvim_win_get_cursor(0)[1]) end, { desc = "Show current line git blame" })