CTRL-R: Bind ALT-R to toggle-raw
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 0df7d10 · Browse files · 5 files·+11 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+11 added−9 removed
- other:+11 added−9 removed
Provenance
- Commit
e1de29b- Tree
1db8de2- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
0df7d10
5 files changed+11 added−9 removed
modified:shell/key-bindings.bash+2 added-2 removed
79 unmodified lines8081828384848586878814 unmodified lines10310410510610710710810911011149 unmodified lines79 unmodified lines output=$( set +o pipefail builtin fc -lnr -2147483648 | last_hist=$(HISTTIMEFORMAT='' builtin history 1) command perl -n -l0 -e "$script" | FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-x:toggle-raw --wrap-sign '"$'\t'"↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} +m --read0") \ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,alt-r:toggle-raw --wrap-sign '"$'\t'"↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} +m --read0") \ FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) --query "$READLINE_LINE" ) || return READLINE_LINE=$(command perl -pe 's/^\d*\t//' <<< "$output") if [[ -z $READLINE_POINT ]]; then14 unmodified lines output=$( set +o pipefail builtin fc -lnr -2147483648 2> /dev/null | # ( $'\t '<lines>$'\n' )* ; <lines> ::= [^\n]* ( $'\n'<lines> )* __fzf_exec_awk "$script" | # ( <counter>$'\t'<lines>$'\000' )* FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-x:toggle-raw --wrap-sign '"$'\t'"↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} +m --read0") \ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,alt-r:toggle-raw --wrap-sign '"$'\t'"↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} +m --read0") \ FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) --query "$READLINE_LINE" ) || return READLINE_LINE=${output#*$'\t'} if [[ -z $READLINE_POINT ]]; then49 unmodified linesmodified:shell/key-bindings.fish+1 added-1 removed
157 unmodified lines158 159 set -lx FZF_DEFAULT_OPTS (__fzf_defaults '' \160 '--nth=2..,.. --scheme=history --multi --wrap-sign="\t↳ "' \161 '--bind=\'shift-delete:execute-silent(eval history delete --exact --case-sensitive -- (string escape -n -- {+} | string replace -r -a "^\d*\\\\\\t|(?<=\\\\\\n)\\\\\\t" ""))+reload(eval $FZF_DEFAULT_COMMAND)\'' \162- "--bind=ctrl-r:toggle-sort,ctrl-x:toggle-raw --highlight-line $FZF_CTRL_R_OPTS" \162+ "--bind=ctrl-r:toggle-sort,alt-r:toggle-raw --highlight-line $FZF_CTRL_R_OPTS" \163 '--accept-nth=2.. --read0 --print0 --with-shell='(status fish-path)\\ -c)164 165 set -lx FZF_DEFAULT_OPTS_FILE166 set -lx FZF_DEFAULT_COMMAND64 unmodified linesmodified:shell/key-bindings.zsh+2 added-2 removed
130 unmodified lines131 # lines, are set. Also, make sure Perl is installed for multi-line output.132 if zmodload -F zsh/parameter p:{commands,history} 2>/dev/null && (( ${+commands[perl]} )); then133 selected="$(printf '%s\t%s\000' "${(kv)history[@]}" |134 perl -0 -ne 'if (!$seen{(/^\s*[0-9]+\**\t(.*)/s, $1)}++) { s/\n/\n\t/g; print; }' |135- FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-x:toggle-raw --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0") \135+ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,alt-r:toggle-raw --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0") \136 FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"137 else138 selected="$(fc -rl 1 | __fzf_exec_awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |139- FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-x:toggle-raw --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \139+ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,alt-r:toggle-raw --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \140 FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"141 fi142 local ret=$?143 if [ -n "$selected" ]; then19 unmodified linesmodified:CHANGELOG.md+3 added-4 removed
12 unmodified lines13 but it's often more useful when toggled dynamically with the `toggle-raw`14 action.15 16 ```sh17-tree | fzf --reverse --bind ctrl-x:toggle-raw17+tree | fzf --reverse --bind alt-r:toggle-raw18 ```19 20 While non-matching items are displayed in a dimmed color, they are treated just21 like matching items, so you place the cursor on them and perform any action. If33 unmodified lines55 option.56 57 ```sh58 # Use a thinner gutter instead of the default dashed line59-fzf --bind ctrl-x:toggle-raw --gutter-raw ▎59+fzf --bind alt-r:toggle-raw --gutter-raw ▎60 ```61 62 ##### Color and style of non-matching items63 32 unmodified lines96 ```97 98 #### Leveraging raw mode in shell integration99 100-The `CTRL-R` binding (command history) now lets you toggle raw mode with101-`CTRL-X`.100+The `CTRL-R` binding (command history) now lets you toggle raw mode with `ALT-R`.101 102 ### Style changes103 104 This version includes a few minor updates to fzf's classic visual style:2861 unmodified linesmodified:README.md+3 added
520 unmodified lines521 sourcing the script522 - `CTRL-R` - Paste the selected command from history onto the command-line523 - If you want to see the commands in chronological order, press `CTRL-R`524 again which toggles sorting by relevance525+ - Press `ALT-R` to toggle "raw" mode where you can see the surrounding items526+ of a match. In this mode, you can press `CTRL-N` and `CTRL-P` to move527+ between the matching items only.528 - Press `CTRL-/` or `ALT-/` to toggle line wrapping529 - Set `FZF_CTRL_R_OPTS` to pass additional options to fzf530 ```sh531 # CTRL-Y to copy the command into clipboard using pbcopy475 unmodified lines