Skip to main content

Questions tagged [fzf]

Use for questions specific to the command-line fuzzy finder, fzf : https://github.com/junegunn/fzf

Filter by
Sorted by
Tagged with
0 votes
0 answers
71 views

How to setup zsh with fzf history backsearch in tmux (I get zle errors)

I am using tmux with the zsh shell. I try to setup fzf, and I do it like this (inside my zshrc): eval "$(fzf --zsh)" This works, as long as I am not in tmux. I can use Ctrl-R and get the ...
Nathan's user avatar
  • 173
0 votes
1 answer
36 views

How to detach a piped command from the terminal?

I want to allow the leading program(s) to operate in a standard manner and detach from the terminal once a graphical application launches. In this example fzf reads paths from a file, feeds the ...
user598527's user avatar
0 votes
0 answers
37 views

How to copy fzf preview window directly to the terminal

Is there a way to print the contents of the fzf preview window directly to the terminal? The only way I have found so far is to repeat everything in the --bind section, then pass the result to xclip ...
user167612's user avatar
  • 1,700
0 votes
0 answers
105 views

using CTRL+T of fzf to put commands on command line

I keep a list of frequently used command snipets in a file (called sniplist) that I use to cut/copy what I need onto the command line for further editing before execution. I thought I would leverage ...
user167612's user avatar
  • 1,700
0 votes
1 answer
56 views

problematic script: query buku, select via fzf and then print using (again) buku

First and foremost, thank you for taking the time to review the question. I have the following script: select an array of IDs from buku's database, and then use buku again to print information using ...
Răzvan Petruescu's user avatar
0 votes
0 answers
54 views

fzf output to xdotool instead of the terminal

I can create a fzf.sh script to launch a list of items, allow me to select an item, and print the output of the specific line selected to the terminal: #!/bin/bash cat ~/list.txt | fzf --reverse I ...
jophuh's user avatar
  • 23
0 votes
1 answer
45 views

fzf behavior changes when capturing its output

The following command works fine as expected: find ~ -type f | fzf -m --preview-window=up:30% --header "ctrl-f: selected all and exit" --bind "enter:execute(less {})" --bind "...
user167612's user avatar
  • 1,700
0 votes
1 answer
93 views

Fuzzy finding directories is slow

I have following bash script to find git repositories. echo "$(fd -I -i -H -E '.local' -E '.cargo' -E '.password-store' -t d ^.git$ ~ -x 'echo' '{//}' | sk)" fd pipes search results to sk (...
s1n7ax's user avatar
  • 418
0 votes
0 answers
209 views

select menu option from a file --shell scripting

I have A question regarding the menu in shell scripting. I created a menu in shell scripting. however, in one of the options, I have a list the user can select from but the list is big, so I want the ...
sun moon's user avatar
0 votes
0 answers
123 views

fzf refuses to execute in bind option when selection is a path

This is the test script: zapit() { find ~/ -type d | fzf --header='ENTER to select, ESC to abort' --bind='enter:execute(ls {})' } I had my own function call inside the execute bracket. But as the ...
user167612's user avatar
  • 1,700
0 votes
1 answer
467 views

Access/copy contents of preview window of fzf

Is it possible access/copy the contents of the preview window of fzf? For example this code creates a list consisting of the top ten lines of a few selected files: find -type f | fzf --multi --preview=...
user167612's user avatar
  • 1,700
1 vote
1 answer
248 views

is it possible to dump partially filtered fzf result in a file?

I often need all the text lines that fzf has suitably filtered. It allows me to scroll through the list. I can select only one of them ( or more by marking them individually). But I want them all (...
user167612's user avatar
  • 1,700
4 votes
0 answers
272 views

How to add the expanded version of commands involving fzf to history?

Say I would like to edit a file ./long/path/to/my/file/test.py with Vim, but I do not remember the path to the file. In this case, I would run vim `fzf` to use fuzzy search to find and edit the file. ...
Matt's user avatar
  • 181
0 votes
0 answers
564 views

Is there a way to format what fzf displays without formatting its output?

I'm currently trying to write a script that takes a list of filenames with their absolute paths as input and feeds them to fzf. After making a selection, they are passed as command-line arguments etc. ...
Utku Boduroglu's user avatar
0 votes
1 answer
233 views

Understanding bind mapping to switch between emacs and vi modes

tl;dr If I execute the following in bash, Ctrl+z seems to have no effect bind -m vi-command '"\C-z": emacs-editing-mode' bind -m vi-insert '"\C-z": emacs-editing-mode' bind -m ...
Enlico's user avatar
  • 1,677
0 votes
2 answers
745 views

Cannot Display Bash Functions within FZF Preview Window

How do I get the FZF Preview Window to Display Functions from my Current Bash Environment? I want to list my custom bash functions using FZF, and view the code of a selected function in the FZF ...
user2514157's user avatar
2 votes
0 answers
506 views

Replicate backward search with fzf in zsh

I've been struggling to find a simple answer to this and it seems like it is not trivial to customise the default integration of fzf/zsh (would like to understand if I'm wrong here). I am looking for ...
rbhalla's user avatar
  • 121
1 vote
1 answer
132 views

get field from tree with fzf

I've tried something like this tree -C | fzf --ansi | awk -F'|' '{print $NF}' ├── repo.git/ │   ├── folder/ │   │   ├── subfolder/ │   │   │   ├── output.0 │   │   │   └── traces.1 │   │   ├── ...
testoflow's user avatar
  • 117
0 votes
1 answer
37 views

Unable to get multicharacter field in fzf preview

_select () { apt-cache search '' | fzf \ --prompt='search: '\ --marker="M" \ --ansi \ --layout=reverse \ --cycle \ --multi \ --inline-info \ --preview "...
testoflow's user avatar
  • 117
0 votes
1 answer
327 views

How to search for directory containing file

I just discovered fzf (fuzzy finder) and now want to achieve the following using fd (https://github.com/sharkdp/fd): From the current directory find immediate parent directories of all files that ...
Richard's user avatar
  • 101
0 votes
1 answer
61 views

How do I exactly alias this one liner in bash?

bash alias doesn't like the quotes dpkg-query -W -f '${Installed-Size;8}kb ${Package} ${Version} ${Status}\n' | sort -n | column -t | grep -Pv "(lib*)" | fzf
genggi's user avatar
  • 1
0 votes
1 answer
97 views

How to cancel a zle function after triggering the bindkey?

Hope you're doing well. I have the following in my .zshrc: # 1. invoke zoxide to pick dir # 2. open target dir in ranger # 3. when exiting ranger, cd into last dir zoxide_to_ranger () { eval '...
kohane15's user avatar
  • 174
3 votes
1 answer
749 views

Cannot source file using find, fzf, and xargs

I am trying to use fzf to select and activate different virtual environments. However, I am receiving the follow error: xargs: source: No such file or directory My command comprises three parts: find |...
user2514157's user avatar
2 votes
1 answer
615 views

zsh function with fzf selection requires Enter

I wrote a simple zsh function which allows me to select from the dirs-stack via fzf. My .zshrc looks like DIRSTACKSIZE='99' setopt PUSHD_IGNORE_DUPS # change to directory from the dirs stack fzf-...
abu_bua's user avatar
  • 249
0 votes
0 answers
1k views

fzf not using `$FZF_DEFAULT_COMMAND`

I'm trying to get fzf to use rg --files as its command for searching, but can't seem to get it to use the $FZF_DEFAULT_COMMAND environment variable, as described in the docs. I use fish as my shell, ...
cameron1024's user avatar
1 vote
1 answer
962 views

Dynamically update fzf items

I am writing a script that searches the system for files and then for each file does some sanity checks, and if they pass those, I want to display them in fzf. When the item is clicked on in fzf, I ...
Kyu96's user avatar
  • 183
0 votes
1 answer
1k views

How to I properly set the advanced FZF_DEFAULT_COMMAND environment variable to get it working properly with ohmyz.sh with fzf plugin installed?

I'm new to z shell and ohmyz.sh. I have the following in my zshrc to integrate fzf with rg. This is exactly how it appears in the fzf readme: FZF_BASE=/usr/local/bin DISABLE_FZF_AUTO_COMPLETION="...
StevieD's user avatar
  • 945
16 votes
3 answers
24k views

fzf: ctlr-r not triggering history search on command line

I've installed fzf on debian 11 (bullseye). When I type in ctrl-r to trigger a history search, nothing happens. Works fine on my mac. I'm using zsh. UPDATE: tried adding bindkey '^r' fzf-history-...
StevieD's user avatar
  • 945
6 votes
3 answers
2k views

How to get a fuzzy xdg-open with fzf in zsh?

THE QUESTION I've been trying to use fzf to bind a shortcut (preferebly Ctrl + o) to interactively search a file and pipe it to xdg-open in zsh. Many shortcuts are already part of the fzf utility, as ...
pesader's user avatar
  • 81
3 votes
2 answers
2k views

Mapfile not removing trailing newline

Sample Data: Tab separated tsv file a.1.58 fadado/CSV https://github.com/fadado/CSV a.1.63 jehiah/json2csv https://github.com/jehiah/json2csv a.1.80 stedolan/jq https://github.com/stedolan/jq/...
Porcupine's user avatar
  • 2,056
0 votes
2 answers
1k views

How do I use FZF's keybinding in ZSH's vi mode?

After applying the command: set -o vi in ZSH, I can't get FZF keybinding works as before, ex ^CR for reverse history search.. How can I make this works again?
logbasex's user avatar
  • 105
5 votes
0 answers
2k views

How to have the results of an `fzf` selection enter my bash history?

FZF is a lovely tool, the main issue I have is that the commands I end up running with it don't end up in my bash history. Let's say I do this history | fzf And I choose a command I ran recently, say ...
John Allard's user avatar
  • 1,378
8 votes
2 answers
4k views

How may I use regular expressions with fzf?

In vim for example, you search names like test1, test2 or test9 if you press /\<test\d\>. I'd like to have this "feature" like finding filesnames which have the word test<num> in ...
TornaxO7's user avatar
  • 187
0 votes
1 answer
89 views

Global shell varible resets on shell startup

I've tried using fzf, and I've done export FZF_DEFAULT_COMMAND as per the instructions. I set it to ag -g "". For the rest of the session, echo $FZF_DEFAULT_COMMAND gives me ag -g "&...
twlscnds's user avatar
  • 113
0 votes
0 answers
23 views

Local variables in zsh functions and their return code [duplicate]

Consider the following zsh function function foobar() { local foo=$(fzf) && echo "$foo-bar" } if instead of selecting one of the results of the fzf command I exit fzf without ...
noibe's user avatar
  • 387
2 votes
1 answer
2k views

How can I launch fzf inside vim and open the selected file on a split window?

How can I launch fzf inside vim and open the selected file on a split window? I don't want to install any plugin. I tried :!a=$(ls | fzf) && vsplit $a
testoflow's user avatar
  • 117
0 votes
2 answers
859 views

How do I backup/restore fzf history?

A very simple question, where is the data stored related to fzf? I'd like to copy my "fzf history" from one machine to another... Can't seem to find this mentioned anywhere.
Chris Stryczynski's user avatar
3 votes
1 answer
871 views

Using fzf in a zle key binding

I have the following function in my .zshrc function foo() { filename="$(fzf)" } zle -N foo bindkey '^X' foo now if I call foo by typing it, it works as expected, but if I call it via ...
noibe's user avatar
  • 387
1 vote
1 answer
819 views

Making a simple app launcher with urxvt and fzf

I've been trying to cobble together a simple program launcher with a terminal and fzf to bind to a hotkey but I haven't been able to make the terminal window close once the program starts without ...
ppk's user avatar
  • 13
0 votes
1 answer
954 views

How to execute command alias, saved as a string variable in a zsh function?

I have a function fz(){file=$(find | fzf) && echo $file && read order && $("$order" "$file")} in my .zshrz. It allows me to look up for a file anywhere in ...
sunLightLeaf's user avatar
3 votes
1 answer
2k views

How to use fzf to search within all lines of files (ignore newlines)?

The fzf examples wiki page describes how fzf can be used to fuzzy search within the content all the files of a directory. But in the examples from the wiki page, e.g. with ag --nobreak --nonumbers --...
Chris's user avatar
  • 31
0 votes
1 answer
663 views

Passing a Directory to cd

I have a function, which I would hope would get me a fuzzy search on the latest directories I have been looking at and save me time, a simple 1 liner: dirs | sed 'y/ /\n/' | fzf | xargs cd 2 hours ...
Snickers3192's user avatar
2 votes
1 answer
576 views

How to use terminal as program runner with FZF

I have a thought. Can I use a terminal as program runner? Instead of dmenu / rofi I was thinking to list all the programs with FZF, run the selection, and then close the terminal after it runs. I ...
Nora's user avatar
  • 21
0 votes
1 answer
3k views

List all directories in home folder with fd

I'm trying to write a shell function to rapidly cd into any directory in my home folder, using the fd and fzf programs. This is what I have so far function fdcd() { cd "$(fd --type d --ignore-file ...
noibe's user avatar
  • 387
14 votes
2 answers
19k views

How to auto-trigger history search in zsh using fzf (fuzzy finder)?

Is it possible to trigger fzf history search automatically in zsh shell? In this video, the user clicks Ctrl+r to start the history search and then starts typing. Is it possible to start the history ...
kvs's user avatar
  • 141
2 votes
1 answer
852 views

fzf: How to return "ID" / line numbers?

I have a set of lines (item + description) which I want to run through fzf -m. For example: item1: Some description item1: Another description item2: Yet another description After selection I would ...
Budiman Snowman's user avatar
2 votes
1 answer
1k views

Launch default application for files with fzf

fzf has some keybindings of which some are listed below as examples: Alt+C: cd into the selected directory Ctrl+T: select a file I want to add a keybiding so that I can launch the selected file with ...
3N4N's user avatar
  • 923
1 vote
0 answers
95 views

how to use fzf with bidirectional languages?

I am using a bash script to provide a search utlilty to locate and open files and directories. here is the script: #!/bin/bash lxterminal -e "bicon.bin locate /home /run/media |fzf >| ~/....
Neo Mosaid's user avatar