FZF_DEFAULT_COMMAND

This commit is contained in:
Junegunn Choi 2013-11-02 12:56:43 +09:00
parent 682583e88f
commit 6a9970c98e
3 changed files with 14 additions and 7 deletions

View File

@ -46,8 +46,8 @@ fzf can be installed as a Ruby gem
gem install fzf
```
However, this is not recommended since the Ruby gem version of fzf takes
slightly longer to start.
It's a bit easier to install and update the script but the Ruby gem version
takes slightly longer to start.
### Install as Vim plugin
@ -87,7 +87,8 @@ find * -type f | fzf > selected
```
Without STDIN pipe, fzf will use find command to fetch the list of
files (excluding hidden ones).
files excluding hidden ones. (You can override the default command with
`FZF_DEFAULT_COMMAND`)
```sh
vim `fzf`
@ -156,9 +157,14 @@ fkill() {
ps -ef | sed 1d | fzf | awk '{print $2}' | xargs kill -${1:-9}
}
# CTRL-T - Open fuzzy finder and paste the selected item to the command line
# Assuming you don't use the default CTRL-T and CTRL-R
# CTRL-T - Paste the selected file path into the command line
bind '"\er": redraw-current-line'
bind '"\C-t": " \C-u \C-a\C-k$(fzf)\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er"'
# CTRL-R - Paste the selected command from history into the command line
bind '"\C-r": " \C-e\C-u$(history | fzf +s | sed \"s/ *[0-9]* *//\")\e\C-e\er"'
```
License

5
fzf
View File

@ -10,7 +10,7 @@
# URL: https://github.com/junegunn/fzf
# Author: Junegunn Choi
# License: MIT
# Last update: October 29, 2013
# Last update: November 2, 2013
#
# Copyright (c) 2013 Junegunn Choi
#
@ -269,7 +269,8 @@ end
@read =
if $stdin.tty?
if !`which find`.empty?
IO.popen("find * -path '*/\\.*' -prune -o -type f -print -o -type l -print 2> /dev/null")
IO.popen(ENV.fetch('FZF_DEFAULT_COMMAND',
"find * -path '*/\\.*' -prune -o -type f -print -o -type l -print 2> /dev/null"))
else
exit 1
end

View File

@ -1,7 +1,7 @@
# coding: utf-8
Gem::Specification.new do |spec|
spec.name = 'fzf'
spec.version = '0.1.1'
spec.version = '0.1.2'
spec.authors = ['Junegunn Choi']
spec.email = ['junegunn.c@gmail.com']
spec.description = %q{Fuzzy finder for your shell}