From 6991c1f86eb9fa449a186ab047e88063d3a14484 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Sun, 24 Dec 2023 01:16:22 -0800 Subject: [PATCH] fix: git commit hash yank to consider `clipboard` (#966) --- lua/fzf-lua/actions.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/fzf-lua/actions.lua b/lua/fzf-lua/actions.lua index be584bc3..a23c129e 100644 --- a/lua/fzf-lua/actions.lua +++ b/lua/fzf-lua/actions.lua @@ -593,8 +593,15 @@ end M.git_yank_commit = function(selected, opts) local commit_hash = match_commit_hash(selected[1], opts) + if vim.o.clipboard == "unnamed" then + vim.fn.setreg([[*]], commit_hash) + elseif vim.o.clipboard == "unnamedplus" then + vim.fn.setreg([[+]], commit_hash) + else + vim.fn.setreg([["]], commit_hash) + end + -- copy to the yank register regardless vim.fn.setreg([[0]], commit_hash) - vim.fn.setreg([["]], commit_hash) end M.git_checkout = function(selected, opts)