Bind CTRL-/ and ALT-/ to toggle-wrap by default
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 8ff4e52 · Browse files · 7 files·+18 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+18 added−16 removed
- other:+18 added−16 removed
Provenance
- Commit
3b2e932- Tree
7ca79c0- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
8ff4e52
7 files changed+18 added−16 removed
modified:man/man1/fzf.1+1 added-1 removed
1495 unmodified lines1496 \fBtoggle\-search\fR (toggle search functionality)1497 \fBtoggle\-sort\fR1498 \fBtoggle\-track\fR (toggle global tracking option (\fB\-\-track\fR))1499 \fBtoggle\-track\-current\fR (toggle tracking of the current item)1500- \fBtoggle\-wrap\fR1500+ \fBtoggle\-wrap\fR \fIctrl\-/\fR \fIalt\-/\fR1501 \fBtoggle+up\fR \fIbtab (shift\-tab)\fR1502 \fBtrack\-current\fR (track the current item; automatically disabled if focus changes)1503 \fBtransform(...)\fR (transform states using the output of an external command)1504 \fBtransform\-border\-label(...)\fR (transform border label using an external command)183 unmodified linesmodified:shell/key-bindings.bash+2 added-2 removed
60 unmodified lines6162636465656667686920 unmodified lines9091929394949596979848 unmodified lines60 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 --highlight-line ${FZF_CTRL_R_OPTS-} +m --read0") \ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --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" ]]; then20 unmodified lines output=$( set +o pipefail builtin fc -lnr -2147483648 2> /dev/null | # ( $'\t '<lines>$'\n' )* ; <lines> ::= [^\n]* ( $'\n'<lines> )* command $__fzf_awk "$script" | # ( <counter>$'\t'<lines>$'\000' )* FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line ${FZF_CTRL_R_OPTS-} +m --read0") \ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --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" ]]; then48 unmodified linesmodified:shell/key-bindings.fish+2 added-2 removed
70 unmodified lines71 # history's -z flag was added in fish 2.4.0, so don't use it for versions72 # before 2.4.0.73 if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];74 if type -P perl > /dev/null 2>&175- set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS +m")75+ set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '"\t"↳ ' --highlight-line $FZF_CTRL_R_OPTS +m")76 set -lx FZF_DEFAULT_OPTS_FILE ''77 builtin history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | command perl -pe 's/^\d*\t//' | read -lz result78 and commandline -- $result79 else80- set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "--scheme=history --bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS +m")80+ set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "--scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '"\t"↳ ' --highlight-line $FZF_CTRL_R_OPTS +m")81 set -lx FZF_DEFAULT_OPTS_FILE ''82 builtin history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result83 and commandline -- $result84 end113 unmodified linesmodified:shell/key-bindings.zsh+2 added-2 removed
111 unmodified lines112 # history lines, is loaded, and that Perl is installed for multi-line output.113 if zmodload -F zsh/parameter p:history 2>/dev/null && (( ${#commands[perl]} )); then114 selected="$(printf '%s\t%s\000' "${(kv)history[@]}" |115 perl -0 -ne 'if (!$seen{(/^\s*[0-9]+\**\t(.*)/s, $1)}++) { s/\n/\n\t/g; print; }' |116- FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0") \116+ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0") \117 FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"118 else119 selected="$(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |120- FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \120+ FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \121 FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"122 fi123 local ret=$?124 if [ -n "$selected" ]; then19 unmodified linesmodified:src/terminal.go+2 added
615 unmodified lines616 add(tui.CtrlY, actYank)617 if !util.IsWindows() {618 add(tui.CtrlZ, actSigStop)619 }620+ add(tui.CtrlSlash, actToggleWrap)621+ addEvent(tui.AltKey('/'), actToggleWrap)622 623 addEvent(tui.AltKey('b'), actBackwardWord)624 add(tui.ShiftLeft, actBackwardWord)625 addEvent(tui.AltKey('f'), actForwardWord)4397 unmodified linesmodified:CHANGELOG.md+8 added-6 removed
5 unmodified lines6 - Implemented line wrap of long items7 - `--wrap` option enables line wrap8 - `--wrap-sign` customizes the sign for wrapped lines (default: `↳ `)9 - `toggle-wrap` action toggles line wrap10- ```sh11- history | fzf --tac --wrap --bind 'ctrl-/:toggle-wrap'12-13- # You can press CTRL-/ to toggle line wrap in CTRL-R binding14- export FZF_CTRL_R_OPTS=$'--bind ctrl-/:toggle-wrap --wrap-sign "\t↳ "'15- ```10+ ```sh11+ history | fzf --tac --wrap --bind 'ctrl-/:toggle-wrap' --wrap-sign $'\t↳ '12+ ```13+ - fzf by default binds `CTRL-/` and `ALT-/` to `toggle-wrap`14+- Updated shell integration scripts to leverage line wrap15+ - CTRL-R binding includes `--wrap-sign $'\t↳ '` to indent wrapped lines16+ - `kill **` completion uses `--wrap` to show the whole line by default17+ instead of showing it in the preview window18 - Added `--info-command` option for customizing the info line19 ```sh20 # Prepend the current cursor position in yellow21 fzf --info-command='echo -e "\x1b[33;1m$FZF_POS\x1b[m/$FZF_INFO 💛"'2184 unmodified linesmodified:README.md+1 added-3 removed
462 unmodified lines463 sourcing the script464 - `CTRL-R` - Paste the selected command from history onto the command-line465 - If you want to see the commands in chronological order, press `CTRL-R`466 again which toggles sorting by relevance467+ - Press `CTRL-/` or `ALT-/` to toggle line wrapping468 - Set `FZF_CTRL_R_OPTS` to pass additional options to fzf469 ```sh469- # CTRL-/ to toggle small preview window to see the full command470 # CTRL-Y to copy the command into clipboard using pbcopy471 export FZF_CTRL_R_OPTS="472- --preview 'echo {}' --preview-window up:3:hidden:wrap473- --bind 'ctrl-/:toggle-preview'472 --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'473 --color header:italic474 --header 'Press CTRL-Y to copy command into clipboard'"475 ```433 unmodified lines