-
-
Notifications
You must be signed in to change notification settings - Fork 798
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 option to open commit diff in a buffer from Commits or BCommits, a la FZF #860
Comments
#528 implements open diff for bcommits when doing |
I guess what I really want is integration with fugitive (because that's what fzf.vim) does. I imagine that would require a bit more thought. |
For future readers - what I ended up using instead: https://github.com/junegunn/gv.vim |
With diffview.nvim you can easily write actions that I think achieve what you were looking for as suggested in this thread local action_state = require "telescope.actions.state"
local ts_utils = require "telescope.utils"
-- in your setup
pickers = {
git_commits = {
mappings = {
i = {
["your mapping here"] = function(prompt_bufnr)
actions.close(prompt_bufnr)
local value = action_state.get_selected_entry().value
-- changes from commit against current index
local cmd = "DiffviewOpen " .. value
-- for changes from one commit to the previous one
local cmd = "DiffviewOpen " .. value .. "~1.." .. value
--- feature branch against branch of your choice
local rev = ts_utils.get_os_command_output({ "git", "rev-parse", "branch-name-here" }, vim.loop.cwd())[1]
cmd = "DiffviewOpen " .. rev .. " " .. value)
vim.cmd(cmd)
end,
}
}
} |
+1. I also much prefer fzf FWIW I have being using the following code to open in fugitive. actions.git_fugitive = function(prompt_bufnr)
local cwd = action_state.get_current_picker(prompt_bufnr).cwd
local selection = action_state.get_selected_entry()
actions.close(prompt_bufnr)
sha = selection.value
vim.cmd("execute 'vsplit' FugitiveFind(luaeval('sha'))")
end |
Is your feature request related to a problem? Please describe.
Currently action mapped in commits picker is checkout. This is quite often not what I want and I would rather have an option to see commit's diff in a buffer. Diff in the preview would somewhat solve the problem. It still does not give all the power and flexibility of a separate buffer though.
Describe the solution you'd like
There is an option to override action on from commits/bcommits, so that instead of checking out this commit I get a buffer with this commit's diff.
Describe alternatives you've considered
Continuing to use fzf.vim for this.
Additional context
There is #528 which I assume will unblock this?
The text was updated successfully, but these errors were encountered: