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
1 answer
32 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
  • 387
0 votes
0 answers
76 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
49 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 ...
elmo's user avatar
  • 105
0 votes
1 answer
198 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=...
elmo's user avatar
  • 105
1 vote
1 answer
56 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 (...
elmo's user avatar
  • 105
3 votes
0 answers
199 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
  • 161
0 votes
0 answers
251 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
80 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,471
0 votes
1 answer
349 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
257 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
102 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
34 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
198 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
55 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
64 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
  • 155
2 votes
1 answer
475 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
437 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
  • 251
0 votes
0 answers
933 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
634 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
  • 143
0 votes
1 answer
747 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
  • 875
13 votes
3 answers
14k 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
  • 875
6 votes
3 answers
1k 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
1k 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
  • 1,700
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
3 votes
0 answers
1k 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,318
7 votes
2 answers
3k 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
  • 177
0 votes
1 answer
87 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
1k 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
1 answer
650 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
691 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
661 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
697 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
1k 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
532 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
475 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
2k 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
10 votes
2 answers
14k views

Auto trigger history search in terminal 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 ...
kvs's user avatar
  • 101
2 votes
1 answer
629 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
1 vote
1 answer
862 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
  • 817
1 vote
0 answers
92 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