Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git Log in visual mode #2358

Open
agusdmb opened this issue Nov 27, 2024 · 0 comments
Open

Git Log in visual mode #2358

agusdmb opened this issue Nov 27, 2024 · 0 comments

Comments

@agusdmb
Copy link

agusdmb commented Nov 27, 2024

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,
			},
		},
	},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant