@@ -27,6 +27,7 @@ echo 'CH=' >> $JJFZF_TEMPD/rebase.env
2727echo ' TO=--destination' >> $JJFZF_TEMPD /rebase.env
2828echo ' SP=false' >> $JJFZF_TEMPD /rebase.env
2929echo ' II=' >> $JJFZF_TEMPD /rebase.env
30+ echo ' WORDS=' >> $JJFZF_TEMPD /rebase.env
3031if [[ $JJFZF_CREVS =~ \| ]] ; then
3132 echo ' FR=--revisions' >> $JJFZF_TEMPD /rebase.env # multi revs
3233else
@@ -61,15 +62,18 @@ B+=( --bind "alt-p:execute-silent( sed 's/^SP=false/SP=x/; s/^SP=true/SP=false/;
6162H+=( ' Alt-I: Ignore-Immutable permits rebasing immutable commits' )
6263B+=( --bind " alt-i:execute-silent( sed 's/^II=-.*/II=x/; s/^II=$/II=--ignore-immutable/; s/^II=x.*/II=/' -i $JJFZF_TEMPD /rebase.env )+refresh-preview" )
6364
64- H+=( " Ctrl-D: Destination — pick the target to rebase onto" )
65- B+=( --bind " ctrl-d:execute-silent( sed 's/^TO=.*/TO=--destination/' -i $JJFZF_TEMPD /rebase.env )+refresh-preview" )
66-
6765H+=( " Ctrl-A: After — pick the target to insert after" )
6866B+=( --bind " ctrl-a:execute-silent( sed 's/^TO=.*/TO=--insert-after/' -i $JJFZF_TEMPD /rebase.env )+refresh-preview" )
6967
7068H+=( " Ctrl-B: Before — pick the target to insert before" )
7169B+=( --bind " ctrl-b:execute-silent( sed 's/^TO=.*/TO=--insert-before/' -i $JJFZF_TEMPD /rebase.env )+refresh-preview" )
7270
71+ H+=( " Ctrl-D: Destination — pick the target to rebase onto" )
72+ B+=( --bind " ctrl-d:execute-silent( sed 's/^TO=.*/TO=--destination/' -i $JJFZF_TEMPD /rebase.env )+refresh-preview" )
73+
74+ H+=( " Ctrl-W: Word-level merging — merge words not lines" )
75+ B+=( --bind " ctrl-w:execute-silent( sed 's/^WORDS=-.*/WORDS=x/; s/^WORDS=$/WORDS=--config=merge.hunk-level=word/; s/^WORDS=x.*/WORDS=/' -i $JJFZF_TEMPD /rebase.env )+refresh-preview" )
76+
7377# == Header Help ==
7478HEADER_HELP=$( printf " %s\n" " ${H[@]} " | jjfzf_bold_keys)
7579B+=( --header " $HEADER_HELP " )
@@ -83,9 +87,9 @@ jjfzf_rebase_enter()
8387 source $JJFZF_TEMPD /rebase.env
8488 # duplicate revisions
8589 if test -n " $DP " ; then
86- jjfzf_run +n jj duplicate $II $TO " $TARGET " -r " $JJFZF_CREVS$CH "
90+ jjfzf_run +n jj duplicate $II $TO " $TARGET " -r " $JJFZF_CREVS$CH " $WORDS
8791 else # rebase revisions
88- jjfzf_run +n jj rebase $II $TO " $TARGET " $FR " $JJFZF_CREVS "
92+ jjfzf_run +n jj rebase $II $TO " $TARGET " $FR " $JJFZF_CREVS " $WORDS
8993 fi
9094 # simplify-parents
9195 if $SP ; then
@@ -105,9 +109,9 @@ jjfzf_rebase_plan()
105109 source $JJFZF_TEMPD /rebase.env
106110 echo
107111 test -z " $DP " ||
108- echo " jj duplicate $II $TO $TARGET -r '$JJFZF_CREVS '$CH "
112+ echo " jj duplicate $II $TO $TARGET -r '$JJFZF_CREVS '$CH " $WORDS
109113 test -n " $DP " ||
110- echo " jj rebase $II $TO $TARGET $FR '$JJFZF_CREVS '"
114+ echo " jj rebase $II $TO $TARGET $FR '$JJFZF_CREVS '" $WORDS
111115 echo
112116 test $SP == true &&
113117 echo " jj simplify-parents -r '$JJFZF_CREVS '"
0 commit comments