Giter Club home page Giter Club logo

fzf's Introduction

I develop and maintain open-source projects that boost developer productivity.

If you like my work, you can support me on GitHub Sponsors.

Many thanks. Take care and stay safe.

fzf's People

Contributors

a1346054 avatar ambrevar avatar blueyed avatar calestyo avatar charlievieth avatar delapouite avatar dependabot[bot] avatar gene-pavlovsky avatar jablko avatar janlazo avatar junegunn avatar justinmk avatar kassio avatar kelleyma49 avatar langlangbart avatar liskin avatar mhinz avatar muesli avatar naveensrinivasan avatar nthapaliya avatar onee-only avatar orschiro avatar pokey avatar qiemem avatar relastle avatar sencer avatar step- avatar vifon avatar vovcacik avatar wellle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fzf's Issues

ZSH share_history doesn't work with fzf

How to reproduce:

  1. Enable this options in ~/.zshrc: extended_history, inc_append_history, share_history
  2. Restart shell
  3. Open two tabs (shells)
  4. Type 'echo 123' in first shell
  5. Press Ctrl+R in second shell: 'echo 123' is not in history
  6. Type 'history' in second shell: 'echo 123' is in history
  7. Repeat 5th step: magically 'echo 123' is in history this time

I expect fzf to show me full history every time I press Ctrl+R.
Guess the thing is that fzf doesn't reread ~/.zsh_history until 'history' is executed.

UPD: Maybe this is not fzf bug, because if I disable Ctrl+R hotkey in fzf zsh behaves the same way. But anyway, it would be great, if fzf could fix that.

CTRL-Q to quit the finder

Hi and thanks for the awesome tool!

Would it be possible to add a CTRL-Q key binding for quitting the finder?

Best regards,
Anton

An option for smarter case sensitivity

It would great to have an option similar to smartcase in vim: automatically turn on case sensitivity if the pattern contains upper case characters, otherwise keep it case-insensitive. Thanks again! :)

Weird graphical issues in tmux

I'm getting some weird graphical issues when using fzf in a tmux session. I don't have any problems when using it outside of tmux. I'm on OS X using zsh in iTerm2.

fzf

FZF+ I3 + DMENU

Hello,

I really really love your tool except one thing it is written in ruby ;-), however, I'm fine with this. I'm working to integrate your engine to work with dmenu & i3 wm window switcher.

In i3 WM, I hit alt-d it show list of window for choose to focus which powered by dmenu (see https://github.com/ziberna/i3-py/blob/master/examples/winmenu.py) I want to do similar things with fzf.

One thing that I don't like dmenu is that it doesn't support fuzzy matching. I also don't prefer to install too many fuzzy engine on my machine.

Currently, I have slmenu, dmenu, ctrlp, and fzf. As I know you tool, I want to eliminate other tools to use one only.

PS: it work be really nice if your such tool can be written in C so the performance will be improved a lot. I don't aware if there such tools written in C

Thanks
Tai

Different Ruby with installation and with execution

I use rbenv and installed 2.1.0 without curses gem.
When I installed fzf, it detected system ruby and installed well but it's not work because shebang of fzf file(#!/usr/bin/env ruby) point to rbenv's ruby, so it couldn't load curses gem.

Remove duplicates?

Command history contains plenty of duplicates usually, and these are just noise. Would be nice to have them removed from the list.

Add flag to select single result immediately

When providing a --query=foo parameter it could be useful to select the only match immediately when there is only one. When there are multiple matches the selection happens as usual.

Could look like this:

fzf --query=foo --select-single

This is related to #26.

Doc that vi-mode requires "set -o vi"

In my .inputrc, I use "set editing-mode vi". Because this puts readline into vi-mode everywhere, I don't have a "set -o vi" in my .bashrc file, which AFAIK is for making "only bash" (and not other readline-using programs) use vi bindings.

Without "set -o vi", when .bashrc sourced .fzf.bash, the set -o | grep vi check returned empty, looking like vi mode was not setup, and so the non-vi key bindings where set.

However, after .bashrc was evaluated, my .inputrc settings took affect, and if I manually run "set -o | grep vi" in a terminal, then it does actually report as on.

Basically, AFAIK, .fzf.bash is running before .inputrc, so doesn't see the "set editing-mode vi" flag.

After struggling quite awhile with trying to figure out why Ctrl-T was doing bizarre things, I finally put "set -o vi" into my .bashrc, and now things work much better.

A hint in the docs might help future users avoid this confusion. I can add something to the readme if you like, unless it's terribly obvious that anyone using "set editing-mode vi" would of course also have "set -o vi" set. (Obviously it was not obvious to me.)

ctrl-r fails on encoding related problem

Playing around with command lines which have non ascii characters. At some point Ctrl-r started throwing the following.

I would have sent you my history output, but there's too much sensitive data there...

Here's part of the command line which is related to the issue. However, I was playing with it for several hours before it started to cause issues, so I'm not sure that this is the origin of the issue.

select Hráč Protihráč, sum(Zabití) Zabití, sum(Smrtí) Smrtí

This is the exception:

/home/harel/.fzf/fzf:486:in `=~': incompatible encoding regexp match (UTF-8 regexp with IBM852 string) (Encoding::CompatibilityError)
    from /home/harel/.fzf/fzf:486:in `trim'
    from /home/harel/.fzf/fzf:405:in `format'
    from /home/harel/.fzf/fzf:715:in `block (2 levels) in update_list'
    from /home/harel/.fzf/fzf:709:in `each'
    from /home/harel/.fzf/fzf:709:in `each_with_index'
    from /home/harel/.fzf/fzf:709:in `block in update_list'
    from /home/harel/.fzf/fzf:727:in `call'
    from /home/harel/.fzf/fzf:727:in `block in start_renderer'

Using fzf as a kind of "selection menu"

I would like to use fzf as a kind of "selection menu", in that way dmenu may be used. Therefore, it would be nice, if fzf had:

  • a modifiable prompt
  • an option to print the query respectively the literal string to stdout, when fzf has not matched anything

Tmux does not split pane with control-T

When I press control-T in tmux, the pane does not split and fzf does not run successfully. Pressing control-T for the first time has the equivalent result of pressing return at a blank zsh prompt (i.e. nothing happens, except a clean prompt); afterwards, pressing control-T has no visible effect.

If I set FZF_TMUX = 0 (to disable to pane split), then fzf works as intended.

I am using tmux 1.9a (tmux -V) and zsh 5.0.5 with oh-my-zsh.

Narrow down the candidates by multiple keywords

It would be very handy if fzf could perform keywords matching separated by a space " ".

For example, if we look for match of candidates that meet both conditions "foo" and "bar":

foo bar

You can also specify negative conditions with an exclamation mark "!". This matches candidates that meet "foo" but do not meet "bar":

foo !bar

Long file paths causing wrapping artifacts

If I type "cat " and select a really long file name, and it wraps to the second line, then the \C-x\C-r is not sufficient to redraw the line, there is still some artifacts. It looks vaguely like:

$ ls the/really/long/
file.txt really/long

There "really/long" is repeated again after "file.txt", even though the cursor is in the right spot (at the end of the line, after "file.txt ").

I noticed that deleting a character causes the terminal to redraw the end of the line, so I added a dummy "\exa " at the end of the existing vi-mode incantation to delete/re-add the trailing space:

bind '"\C-t": "\e$a \eddi$(__fsel)\C-x\C-e\e0Px$a \C-x\C-r\exa "'

This fixes the wrapping artifact issue.

Note that I tried putting the \C-x\C-r before the "a ", thinking that redrawing the line, then appending the space after that might work, but it did not. It seems doing the delete is what kicks in the "clear the rest of the line" behavior that's needed to clear the wrapping artifact.

Add keybindings for vi-mode shell

Currently, CTRL-T and CTRL-R won't work when vi-mode is enabled.

vi-mode

set -o vi
set -o

CTRL-T

bind '"\C-x\C-e": shell-expand-line'
bind '"\C-x\C-r": redraw-current-line'
bind '"\C-t": "\ei $(__fsel)\C-x\C-e\C-x\C-r"'

CTRL-R

bind '"\C-r": "\eddi$(HISTTIMEFORMAT= history | fzf +s | sed \"s/ *[0-9]* *//\")\C-x\C-e\C-x\C-r\e$"'

Some utf-8 input not shown correctly

I have a script that gives me a list of issues to work on, and I wanted to use fzf to choose one. The script uses unicode arrows to denote priority, and these are not shown correctly in fzf.

Input:

PRO-2567 ↧  Do thing 1
PRO-2573 ↥  Do thing 2
PRO-2683 ⇊  Do thing 3

What fzf renders:

PRO-2567 F�  Do thing 1
PRO-2573 F�  Do thing 2
PRO-2683 G~J  Do thing 3

.fzf.bash breaks git/bash completions

Whichever of these two that gets sourced first stops working. If .fzf.bash is first, the vim ~/**<TAB> stuff will stop working, and if the other way around git <TAB> will stop working.

.bash_profile

# Add tab completion for many Bash commands
if [ -f "$(brew --prefix)/etc/bash_completion" ]; then
    source "$(brew --prefix)/etc/bash_completion"
fi

# Enable fzf
if [ -e "$HOME/.fzf.bash" ]; then
    source "$HOME/.fzf.bash"
fi

Can't scroll results

If the search provides more results than fit in one screen, I am unable to scroll outside of the ones that are currently showing.

extended mode: ^foo$ does not match directory "foo", but foo$ and ^foo does

Not sure if this is by design (I know extended-mode isn't supposed to be a full regex matcher), but thought I'd report it.

If foo is a directory in the current directory, try fzf -x with the following inputs:

  • ^foo returns all results starting with foo, including the foo directory
  • foo$ returns nothing
  • foo/$ returns nothing
  • ^foo$ returns nothing

Try find ${1:-*} 2> /dev/null | fzf -x (which I use to include hidden files/directories, not sure if there's a better way):

  • foo$ returns all results ending with foo, including the foo directory
  • ^foo returns all results starting with foo, including the foo directory
  • ^foo$ returns nothing

I finally got around to installing fzf yesterday, and I must say it is an extremely thoughtfully-designed and pleasant experience. Nice work!

Allow C-V, C-S, C-T, etc. in vim plugin

The only thing really stopping me from replacing ctrlp entirely with fzf is support for <C-V> to vsplit, <C-S> to hsplit, <C-T> to open in a new tab, etc.

Separate multiple patterns by space

In a recent discussion about Zed the topic of fuzzy matching came up and I liked the idea of using multiple patterns separated by space.

In Komodo, space is treated as a logical AND, which you can use to more effectively search the above.

I imagine it like this: I have entered the search term foobar and it's currently matching hundreds of lines beginning with foo and ending with bar. To match the single line foo/gunn/bar I would just append to foobar gunn instead of having to remove bar.

Makes sense?

utilize git for finding relevant files

traversing e.g large git repositories with find is suboptimal, so it would be nice if fzf had to option to automatically use the fastest method available.
Something like this seems to work ~ an order of magnitude faster for me:

f()
{
    if [ -z $(git rev-parse --abbrev-ref HEAD 2>/dev/null) ]; then
        fzf $*
    else
        FZF_DEFAULT_COMMAND="git ls-tree -r --name-only $(git rev-parse --abbrev-ref HEAD)" fzf $*
    fi
}

Use tab to select a command

It'd be a good idea to be able to use TAB to hit a command (instead of just ENTER as it is now). That's for example on the command line history search.

Priorization of best matches

The algorithm sorting the matches should give priority to better matches.

Example: In a repo of mine, searching for "login" finds a lot of things, selecting

"gae/brokenlinkshunter/appengine_django/management/commands/vacuum_indexes.py" 

instead of

"logins.rst"

which is obviously a better match.

fish shell support - installer / keybindings

Regardless of on whatever shell it may be, fzf is installable simply by placing fzf in a directory included in $PATH. However, the install script generates an optimal function wrapper for fzf and defines some useful key bindings. It would be nice if it supports fish as well.

Define faces for virtual console

In the virtual console, the match is invisible (black FG, black BG). As the match gets larger, it becomes impossible to determine which file is which.

Fuzzy find for directories

It would be awesome if fzf would be able to fuzzy find directories as well by providing an additional option on the command line. I'd use it to quickly navigate to a subdirectory.

[Question] how to invoke fzf from GUI (say, using xterm) and get selected filename?

Hello,

I'm trying to use fzf in the GUI 2-panel file manager (double commander), it would be extermely useful.

First question: how to open xterm (or probably other terminal emulator?) with fzf opened?

I tried: xterm -e /usr/bin/ruby /path/to/fzf , but xterm window is opened and immediately closed, I can't read anything even if it writes something. Just in case, I tried xterm -e aptitude , it worked (xterm window is opened with aptitude), but with fzf it doesn't work.

Just by chance, I tried redirect output to the file: xterm -e /usr/bin/ruby /path/to/fzf > /tmp/my_tmp_log, the file /tmp/my_tmp_log is not created at all (I definitely have permissions to do that, so it's not up to permissions)

Second question: how to make it actually return a value? If I execute xterm -e /usr/bin/ruby /path/to/fzf from the already-opened terminal, new xterm window is successfully opened with fzf in it, I can select file, but after that, nothing is returned. So, how to return value?

Thanks!

Enable arrow keys

There're escape sequences for arrow keys:
up - "\027[A"
down - "\027[B"
left - "\027[D"
right - "\027[C"

Why don't use them to navigate in result list? I, personally, find it much better then ^K / ^J - one less key to press.

Support for .fzfignore files?

First of all: I love it. Much faster than CtrlP etc. when run from my home directory.

I'm wondering, how other people narrow down their search. I currently use stuff like

" ~/.vimrc
let g:fzf_source = 'find . -type f | grep -v "AppData/" | grep -v "\.git/" | grep -v "\.mat$"'

and

#~/.fzf.zsh

fzf-filter-ignored() {
  grep -v "AppData/" |
  grep -v "\.git/"
}

#...

  FILES=($(
    find * -path '*/\.*' -prune \
    -o -type f -print \
    -o -type d -print \
    -o -type l -print 2> /dev/null | \
    fzf-filter-ignored | fzf --multi --extended --no-sort))

to exclude files and dirs, which i will never want to access (.git directories come to mind immedately).

Would it be possible to add support for some kind of .fzfignore files, which could be used to exclude certain directories and/or files right away? I'm imagining having a global ~/.fzfignore and then project-specific ones down the directory-tree much like git.

Show recorded times on righthand side

When using i.e. HISTTIMEFORMAT the timestamps are recorded for every command. It would be really nice if there was an option to display them on the right hand side.

Have to select file twice in zsh

When invoking fzf with zsh, the first time you select a file and hit enter the selection seems to be ignored, and you have to do it again, then it behaves as expected. Works perfectly in bash.

Add flag to select single result immediately (revisit issue #27)

Issue 27 (#27) requested a --select-single
option to fzf to automatically select a match if there is only one.

While a workaround was provided, I think this is a common enough use case with a complex enough workaround to merit addition of the actual option.

I am using the fq1() workaround heavily, both in the shell but also in vimscript. Having to duplicate this in two places makes me wish I could just simplify both cases to a single --select-single argument.

Besides improving usability, not having to invoke fzf twice (as the workaround does) would preclude having to move large result sets around in memory and across processes, and save a second invocation of the fzf process. That could have a noticeable performance/memory improvement in some cases.

It may make sense to combine this with a --select-zero option to exit if no matches are found.

Wrong characters displayed under tmux

I tried fzf today on a PC running mintty/Cygwin and on my laptop running iTerm2/OS X and had the same problem both places. The results that come up as I'm typing are corrupted until I scroll through them or type Ctrl-L. This happens in tmux if I run fzf using the Ctrl-R key binding or if I run fzf just as 'fzf' from the command line. It does NOT happen when I invoke it with the Ctrl-T key binding (which opens up a new tmux pane). It also does not happen if I run fzf outside of tmux. I tried it with my .tmux.conf completely blank and that didn't help.

On my laptop I am running zsh 5.0.5, tmux 1.9a (I also tried a newer dev build of tmux, same results), and ruby 2.0.0p451.

Any ideas?

Here's what it looks like before/after redrawing with Ctrl-L:

screen shot 2014-07-09 at 7 05 00 pm
screen shot 2014-07-09 at 7 05 10 pm

MacVim and iTerm2

Howdy,

This is a really neat project. I thought it might be helpful to add some information about how to get it running with MacVim and iTerm2, for users as inept as myself. The following script is, so far, a passible stand-in for "xterm -e". You just need to add it to your Vim's PATH as an executable titled, for example, "In_a_new_term_function" and let g:fzf_launcher = "In_a_new_term_function %s"

#!/bin/bash

osascript -e \
'on run argv
    tell application "System Events"
        set old_frontmost to item 1 of (get name of processes whose frontmost is true)
    end tell
    tell application "iTerm"
        activate
        set myterm to (make new terminal)
        tell myterm
            set mysession to (make new session at the end of sessions)
            tell mysession
                exec command "bash"
                write text "cd " & quoted form of (item 2 of argv) 
                write text (item 1 of argv) & " && exit" 
            end tell
            repeat while (exists myterm)
                delay 0.1
            end repeat
        end tell
    end tell
    tell application old_frontmost
        activate
    end tell
end run' "$1" "$PWD"

Toggling fzf

Thanks for building fzf! Everything's working fine, but I'm wondering what might be a good way to toggle fzf open and closed using just . Is there a hook for fzf to see if it's currently open where I could then just hit again to close it instead of reaching up for ?

Literal option for extended mode

The behaviour in Sublime-Text, CtrlP etc. fuzzy-finders defaults to treating space-seperated chunks as exact-search patterns. If I have a directory structure like so for example

.
└── Projects
    └── asd
        ├── make.m
        └── Makefile

I would like to be able to enter pro asd make in order to get to the 2 files. In extended mode however, I need to quote the chunks individually:

search_with_apostrophes
(desired behaviour, but typing apostophes is annoying)

search_without_apostrophes
(no apostrophes lead to undesired behaviour)

Would it be possible to make the default behaviour in extended mode look for exact matches? Baring that, maybe a different mode -X, which has that behaviour?

Hangs on linux inside tmux

It looks like I'm hit with this bug: https://bugzilla.redhat.com/show_bug.cgi?id=526366

This only happens inside tmux for some reason. After running fzf a few times, it would hang the next time I start it up. strace shows that it's gpm related. I have to manually restart gpm to make it work. This effectively prevents me from using it at work, which is a shame because I love this tool so much. :(

Anyway, let me know if you happen to possess some wizardry to make this work. If not, thanks for the great plugin and I'll still continue to use it on my Macbook.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.