summaryrefslogtreecommitdiffstats
path: root/plugin/50-git.lua
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-05-20 15:00:46 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-05-20 15:00:46 +0200
commit1b0c6c168f74fe73be4e06e1f49dda223849954f (patch)
tree3d0f69321103fc78d288b0563e9cee0b35175c58 /plugin/50-git.lua
parent666114978ef4307b30087beb40aee64e9a1fd963 (diff)
downloadnvim-config-1b0c6c168f74fe73be4e06e1f49dda223849954f.tar.gz
nvim-config-1b0c6c168f74fe73be4e06e1f49dda223849954f.zip
feat(nvim): add GitBlame user command
Diffstat (limited to 'plugin/50-git.lua')
-rw-r--r--plugin/50-git.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugin/50-git.lua b/plugin/50-git.lua
new file mode 100644
index 0000000..66adda8
--- /dev/null
+++ b/plugin/50-git.lua
@@ -0,0 +1,7 @@
+local function git_blame(file, line)
+ vim.cmd(string.format("!git blame --line-porcelain -L %d,%d -- %s", line, line, file))
+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" })