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

Add line_info() : Open blame or hunk preview depending on context #567

Open
WieeRd opened this issue May 17, 2022 · 0 comments
Open

Add line_info() : Open blame or hunk preview depending on context #567

WieeRd opened this issue May 17, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@WieeRd
Copy link

WieeRd commented May 17, 2022

Since lines that can be blamed are mutually exclusive with lines that are inside hunk,
I suggest adding api/command line_info().
If the cursor is on a hunk, it'll call preview_hunk().
If it's not, it'll call blame_line().

local gs = require("gitsigns")

local function line_info(blame_opts)
  local acts = gs.get_actions()
  local func = acts.preview_hunk or acts.blame_line
  if func then func(blame_opts) end
end

I always confused between blame/hunk preview keybind since they do kinda similar thing,
and came up with this simple implementation few days ago. It sure was very useful.

Would be great if this can get included in the plugin itself.
At least as small tip in README if you don't want to add this as a feature.

@WieeRd WieeRd added the enhancement New feature or request label May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant