Skip to content

Commit

Permalink
feat(actions): feedback for copy commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Jan 18, 2025
1 parent fbe21ae commit a534583
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lua/fzf-lua/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,18 @@ end

M.git_yank_commit = function(selected, opts)
local commit_hash = match_commit_hash(selected[1], opts)
local reg
if vim.o.clipboard == "unnamed" then
vim.fn.setreg([[*]], commit_hash)
reg = [[*]]
elseif vim.o.clipboard == "unnamedplus" then
vim.fn.setreg([[+]], commit_hash)
reg = [[+]]
else
vim.fn.setreg([["]], commit_hash)
reg = [["]]
end
-- copy to the yank register regardless
vim.fn.setreg(reg, commit_hash)
vim.fn.setreg([[0]], commit_hash)
utils.info(string.format("commit hash %s copied to register %s, use 'p' to paste.", commit_hash, reg))
end

M.git_checkout = function(selected, opts)
Expand Down

0 comments on commit a534583

Please sign in to comment.