Questions tagged [fzf]
Use for questions specific to the command-line fuzzy finder, fzf : https://github.com/junegunn/fzf
27
questions
1
vote
1
answer
21
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-...
0
votes
0
answers
18
views
How to make FZF autocomplete files from path under cursor
How to get FZF to show files from the path under cursor on the command line?
As opposed to files under the current dir.
For example, suppose I'm at ~/code/projects, type cp on the command line,
press ...
0
votes
0
answers
107
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, ...
1
vote
1
answer
167
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 ...
0
votes
1
answer
178
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="...
3
votes
1
answer
2k
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-...
3
votes
2
answers
457
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 ...
2
votes
2
answers
511
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/...
0
votes
0
answers
89
views
How to create a keyboard shortcut for opening files after searching through fzf
I can launch a file after searching through fzf by doing xdg-open (fzf) (I'm using fish) or fzf | xargs xdg-open. But these do not work if I try to create a shortcut for opening a terminal and ...
0
votes
2
answers
400
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?
1
vote
0
answers
248
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 ...
5
votes
2
answers
939
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 ...
0
votes
1
answer
48
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 "&...
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 ...
1
vote
1
answer
322
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
0
votes
1
answer
222
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.
2
votes
1
answer
322
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 ...
0
votes
1
answer
389
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 ...
0
votes
1
answer
223
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 ...
2
votes
0
answers
452
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 --...
0
votes
1
answer
307
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 ...
1
vote
1
answer
278
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 ...
0
votes
1
answer
839
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 ...
7
votes
2
answers
8k
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 ...
2
votes
1
answer
291
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 ...
1
vote
1
answer
442
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 ...
2
votes
0
answers
76
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 >| ~/....