Bot releases are visible (Hide)
Published by junegunn almost 2 years ago
--tiebreak=chunk
crashes on inverse match queryPublished by junegunn almost 2 years ago
Putting it all together..
# With http://metaphorpsum.com/ and https://github.com/busyloop/lolcat
label1=$(curl -s http://metaphorpsum.com/sentences/1 | lolcat -f)
label2=$(curl -s http://metaphorpsum.com/sentences/1 | lolcat -f)
# Using colors from 'cosmic_latte'
# (See https://github.com/junegunn/fzf/blob/master/ADVANCED.md#generating-fzf-color-theme-from-vim-color-schemes)
fzf --border=double \
--border-label="╣ ${label1} ╠" --border-label-pos=-3,bottom \
--color=bg+:#2b3740,bg:#202a31,spinner:#7d9761,hl:#898f9e,fg:#abb0c0,header:#898f9e,info:#459d90 \
--color=pointer:#7d9761,marker:#7d9761,fg+:#abb0c0,prompt:#7d9761,hl+:#7d9761,border:#2b3740,label:#2b3740 \
--preview='lolcat -f {}' --preview-label="┓ ${label2} ┏" \
--preview-window=top,border-bold \
--separator=$(lolcat -f -F 1.4 <<< ╸╸╸╸╸╸╸╸╸╸╸╸╸╸)
start
event that is triggered only once when fzf finder starts. Since fzf consumes the input stream asynchronously, the input list is not available unless you use --sync
.
seq 100 | fzf --multi --sync --bind 'start:last+select-all+preview(echo welcome)'
--border-label
and --border-label-pos
for putting label on the border
# ANSI color codes are supported
# (with https://github.com/busyloop/lolcat)
label=$(curl -s http://metaphorpsum.com/sentences/1 | lolcat -f)
# Border label at the center
fzf --height=10 --border --border-label="╢ $label ╟" --color=label:italic:black
# Left-aligned (positive integer)
fzf --height=10 --border --border-label="╢ $label ╟" --border-label-pos=3 --color=label:italic:black
# Right-aligned (negative integer) on the bottom line (:bottom)
fzf --height=10 --border --border-label="╢ $label ╟" --border-label-pos=-3:bottom --color=label:italic:black
--preview-label
and --preview-label-pos
for the border of the preview window
fzf --preview 'cat {}' --border --preview-label=' Preview ' --preview-label-pos=2
--no-separator
or --separator=''
to hide the separator--separator=╸
--color=separator:...
fzf --separator=╸ --color=separator:green
fzf --separator=$(lolcat -f -F 1.4 <<< ▁▁▂▃▄▅▆▆▅▄▃▂▁▁) --info=inline
--border=bold
and --border=double
along with --preview-window=border-bold
and --preview-window=border-double
Published by junegunn about 2 years ago
--height
. If the --height
value is prefixed~
, fzf will automatically determine the height in the range accordingseq 1 | fzf --height ~70% --border --padding 1 --margin 1
seq 10 | fzf --height ~70% --border --padding 1 --margin 1
seq 100 | fzf --height ~70% --border --padding 1 --margin 1
# This is not allowed (top/bottom margin in percent value)
fzf --height ~50% --border --margin 5%,10%
# This is allowed (top/bottom margin in fixed value)
fzf --height ~50% --border --margin 2,10%
# fzf will open immediately
(sleep 2; seq 10) | fzf --height 50%
# fzf will open after 2 seconds
(sleep 2; seq 10) | fzf --height ~50%
(sleep 2; seq 1000) | fzf --height ~50%
--no-clear
is deprecated. Use reload
action instead.Published by junegunn about 2 years ago
--scheme=[default|path|history]
option to choose scoring scheme
default
) is not always giving the optimal resultpath
: Additional bonus point is only given to the the characters afterhistory
: No additional bonus points are given so that we give more--tiebreak=index
.printf "\e[38;5;208mOption 1\e[m\nOption 2" | fzf --ansi
printf "\e[38:5:208mOption 1\e[m\nOption 2" | fzf --ansi
border-{up,down}
as the synonyms for border-{top,bottom}
in--preview-window
strikethrough
printf "\e[9mdeleted" | fzf --ansi
fzf --color fg+:strikethrough
Published by junegunn about 2 years ago
--tiebreak=chunk
fzf-tmux -p70%
fzf-tmux -p70% --color=border:bright-red
fzf-tmux -p100%,60% --color=border:bright-yellow --border=horizontal --padding 1,5 --margin 1,0
fzf-tmux -p70%,100% --color=border:bright-green --border=vertical
# Key bindings (CTRL-T, CTRL-R, ALT-C) will use these options
export FZF_TMUX_OPTS='-p100%,60% --color=border:green --border=horizontal --padding 1,5 --margin 1,0'
Published by junegunn about 2 years ago
/,:;|
)# foo/bar.sh` is preferred over `foo-bar.sh` on `bar`
fzf --query=bar --height=4 << EOF
foo-bar.sh
foo/bar.sh
EOF
chunk
length
, this scheme works well with tabular input
# length prefers item #1, because the whole line is shorter,
# chunk prefers item #2, because the matched chunk ("foo") is shorter
fzf --height=6 --header-lines=2 --tiebreak=chunk --reverse --query=fo << "EOF"
N | Field1 | Field2 | Field3
- | ------ | ------ | ------
1 | hello | foobar | baz
2 | world | foo | bazbaz
EOF
chunk
is equivalent tolength
. But we're not going to set it as the default because it isPublished by junegunn about 2 years ago
# If the width of the preview window is smaller than 50 columns,
# it will be displayed above the search window.
fzf --preview 'cat {}' --preview-window 'right,50%,border-left,<50(up,30%,border-bottom)'
# Or you can just hide it like so
fzf --preview 'cat {}' --preview-window '<50(hidden)'
unicode.IsGraphic
constraint--marker
, --pointer
, and --ellipsis
. Allows Nerd Fonts and stuff.kill
completion now requires trigger sequence (**
) for consistencyPublished by junegunn over 2 years ago
--ellipsis
option. You can take advantage of it to make fzf# Search against hidden line numbers on the far right
nl /usr/share/dict/words |
awk '{printf "%s%1000s\n", $2, $1}' |
fzf --nth=-1 --no-hscroll --ellipsis='' |
awk '{print $2}'
rebind
action for restoring bindings after unbind
Published by junegunn almost 3 years ago
change-preview(...)
action to change the --preview
command
preview(...)
is a one-off action that doesn't change the defaultchange-preview-window(...)
action
|
fzf --preview 'cat {}' --preview-window right,40% \
--bind 'ctrl-/:change-preview-window(right,70%|down,40%,border-top|hidden|)'
--info=inline
Published by junegunn almost 3 years ago
--header-first
option to print header before the prompt line
fzf --header $'Welcome to fzf\n▔▔▔▔▔▔▔▔▔▔▔▔▔▔' --reverse --height 30% --border --header-first
--scroll-off=LINES
option (similar to scrolloff
option of Vim)
fzf --scroll-off=5
fzf --scroll-off=999
reload
(#2644)$SHELL
to execute external programs
Published by junegunn about 3 years ago
hidden
by default when there are preview
bindings but --preview
command is not given{n}
is not properly reset on reload
reload
sinklist
is added as a synonym to sink*
so that it's easier to add a function to a spec dictionary
let spec = { 'source': 'ls', 'options': ['--multi', '--preview', 'cat {}'] }
function spec.sinklist(matches)
echom string(a:matches)
endfunction
call fzf#run(fzf#wrap(spec))
Published by junegunn over 3 years ago
fzf --color fg:3,fg+:11
fzf --color fg:yellow,fg+:bright-yellow
--read0
not properly displaying long linesPublished by junegunn over 3 years ago
unbind
action. In the following Ripgrep launcher example, you can use unbind(reload)
to switch to fzf-only filtering mode.
" fzf will read the stream file while allowing other processes to append to it
call fzf#run(fzf#wrap({'source': 'cat /dev/null > /tmp/stream; tail -f /tmp/stream'}))
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'relative': v:true, 'yoffset': 1.0 } }
Published by junegunn over 3 years ago
--preview-window
fzf --preview 'cat {}' --preview-window border-left
fzf --preview 'cat {}' --preview-window border-left --border horizontal
fzf --preview 'cat {}' --preview-window top:border-bottom
fzf --preview 'cat {}' --preview-window top:border-horizontal
/dev/tty
as STDIN on execute action
# Redirect /dev/tty to suppress "Vim: Warning: Input is not from a terminal"
# ls | fzf --bind "enter:execute(vim {} < /dev/tty)"
# "< /dev/tty" part is no longer needed
ls | fzf --bind "enter:execute(vim {})"
Published by junegunn over 3 years ago
# Display top 3 lines as the fixed header
fzf --preview 'bat --style=full --color=always {}' --preview-window '~3'
# Works well with the streaming preview
fzf --preview-window 'follow:~2' --preview 'for i in $(seq 100000); do
# Clear preview content every 300 lines and print header
(( i % 300 == 1 )) && echo -e "\x1b[2J$i ~ $((i + 300))" && echo '---'
echo "$i"
sleep 0.01
done'
# Preview with bat, matching line in the middle of the window below
# the fixed header of the top 3 lines
#
# ~3 Top 3 lines as the fixed header
# +{2} Base scroll offset extracted from the second field
# +3 Extra offset to compensate for the 3-line header
# /2 Put in the middle of the preview area
#
git grep --line-number '' |
fzf --layout reverse --delimiter : \
--preview 'bat --style=full --color=always --highlight-line {2} {1}' \
--preview-window '~3:+{2}+3/2'
select
and deselect
action for unconditionally selecting or--multi
mode. Complements toggle
action.Published by junegunn over 3 years ago
close
action
Published by junegunn almost 4 years ago
Text attributes set in --color
are not reset when fzf sees another
--color
option for the same element. This allows you to put custom text
attributes in your $FZF_DEFAULT_OPTS
and still have those attributes
even when you override the colors.
# Default colors and attributes
fzf
# Apply custom text attributes
export FZF_DEFAULT_OPTS='--color fg+:italic,hl:-1:underline,hl+:-1:reverse:underline'
fzf
# Different colors but you still have the attributes
fzf --color hl:176,hl+:177
# Write "regular" if you want to clear the attributes
fzf --color hl:176:regular,hl+:177:regular
Renamed --phony
to --disabled
You can dynamically enable and disable the search functionality using the
new enable-search
, disable-search
, and toggle-search
actions
You can assign a different color to the query string for when search is disabled
fzf --color query:#ffffff,disabled:#999999 --bind space:toggle-search
Added last
action to move the cursor to the last match
top
is renamed to first
, but top
is stillAdded preview-top
and preview-bottom
actions
Extended support for alt key chords: alt with any case-sensitive single character
fzf --bind alt-,:first,alt-.:last
Published by junegunn almost 4 years ago
--preview-window
option follow
# Preview window will automatically scroll to the bottom
fzf --preview-window follow --preview 'for i in $(seq 100000); do
echo "$i"
sleep 0.01
(( i % 300 == 0 )) && printf "\033[2J"
done'
change-prompt
action
fzf --prompt 'foo> ' --bind $'a:change-prompt:\x1b[31mbar> '
Published by junegunn almost 4 years ago
--padding
option
fzf --margin 5% --padding 5% --border --preview 'cat {}' \
--color bg:#222222,preview-bg:#333333
Published by junegunn almost 4 years ago