tpope/vim-fugitive

Git Log in visual mode

Opened this issue · 0 comments

When i select a range of lines in visual mode, and while in the visual mode i do:

:Git blame

i get the blame only for the selected lines (as i would get when running the command git blame -L x,y filename

I would expect the same behavior when i run in visual mode:

:Git log

but instead i get the complete logs, as running just a plain git log in the command, without the -L option. i think this is inconsistent between git blame and git log and at the same time it would be great to be able to run it like with the :Git blame command in visual mode.


As a work around i have created this map in my lazy configuration:

	{
		"tpope/vim-fugitive",
		dependencies = {
			"tpope/vim-rhubarb",
		},
		cmd = { "G", "Git", "Gdiffsplit", "Gread", "Gwrite", "Ggrep", "GMove", "GDelete", "GBrowse" },
		keys = {
			{
				"<leader>gl",
				":<C-u>execute 'Git log -L ' . line(\"'<\") . ',' . line(\"'>\") . ':' . expand('%')<CR>",
				mode = "v",
				desc = "Git Log (selected lines)",
				noremap = true,
				silent = true,
			},
		},
	},