@@ -668,9 +668,11 @@ M.defaults.git = {
668668 --- @class fzf-lua.config.GitDiff : fzf-lua.config.GitBase
669669 --- Git reference(s) to compare against.
670670 --- @field ref ? string | string[]
671- --- Git reference used as the base for the comparison.
672671 -- `compare_against` was renamed to `ref1`
672+ --- Git reference used as the base for the comparison.
673673 --- @field ref1 ? string
674+ --- Fzf cursor start position for ctrl-q git_commits
675+ --- @field _pos ? number
674676 diff = {
675677 cmd = " git --no-pager diff --name-only {ref1} {ref}" ,
676678 ref = nil ,
@@ -688,7 +690,13 @@ M.defaults.git = {
688690 actions = {
689691 [" ctrl-q" ] = {
690692 fn = function (_ , _o )
691- FzfLua .git_commits (vim .deepcopy (_o .__call_opts ))
693+ local o = vim .deepcopy (_o .__call_opts )
694+ if o ._pos then
695+ o ._fzf_cli_args = o ._fzf_cli_args or {}
696+ table.insert (o ._fzf_cli_args , " --bind="
697+ .. FzfLua .libuv .shellescape (string.format (" load:+pos(%d)" , o ._pos )))
698+ end
699+ FzfLua .git_commits (o )
692700 end ,
693701 reuse = true ,
694702 header = " git commits"
@@ -733,10 +741,12 @@ M.defaults.git = {
733741 local o = vim .deepcopy (_o .__call_opts )
734742 o .ref = s [1 ]:match (" [^ ]+" )
735743 o .ref1 = o .ref .. " ~"
744+ o ._pos = tonumber (s [2 ])
736745 FzfLua .git_diff (o )
737746 end ,
738- reuse = true ,
739- header = " git diff"
747+ header = " git diff" ,
748+ exec_silent = true ,
749+ field_index = " {} $FZF_POS" ,
740750 },
741751 },
742752 fzf_opts = { [" --no-multi" ] = true },
0 commit comments