Skip to content
Myr

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

5 files+11 added−9 removed

modified:shell/key-bindings.bash+2 added-2 removed
modified:shell/key-bindings.fish+1 added-1 removed
157 unmodified lines
158159 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)164165 set -lx FZF_DEFAULT_OPTS_FILE166 set -lx FZF_DEFAULT_COMMAND
64 unmodified lines
modified:shell/key-bindings.zsh+2 added-2 removed
130 unmodified lines
131 # 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" ]; then
19 unmodified lines
modified:CHANGELOG.md+3 added-4 removed
12 unmodified lines
13but it's often more useful when toggled dynamically with the `toggle-raw`14action.1516```sh17tree | fzf --reverse --bind ctrl-x:toggle-raw17tree | fzf --reverse --bind alt-r:toggle-raw18```1920While non-matching items are displayed in a dimmed color, they are treated just21like matching items, so you place the cursor on them and perform any action. If
33 unmodified lines
55option.5657```sh58# Use a thinner gutter instead of the default dashed line59fzf --bind ctrl-x:toggle-raw --gutter-raw ▎59fzf --bind alt-r:toggle-raw --gutter-raw ▎60```6162##### Color and style of non-matching items63
32 unmodified lines
96```9798#### Leveraging raw mode in shell integration99100The `CTRL-R` binding (command history) now lets you toggle raw mode with101`CTRL-X`.100The `CTRL-R` binding (command history) now lets you toggle raw mode with `ALT-R`.101102### Style changes103104This version includes a few minor updates to fzf's classic visual style:
2861 unmodified lines
modified:README.md+3 added
520 unmodified lines
521 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 pbcopy
475 unmodified lines