From 6a9970c98eafc9eb00b99d72272b434d36603e2c Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 2 Nov 2013 12:56:43 +0900 Subject: [PATCH] FZF_DEFAULT_COMMAND --- README.md | 14 ++++++++++---- fzf | 5 +++-- fzf.gemspec | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 16ca8dc..4d4a29b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/fzf b/fzf index 8e5cb95..2bce1bc 100755 --- a/fzf +++ b/fzf @@ -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 diff --git a/fzf.gemspec b/fzf.gemspec index c9aec13..c53c008 100644 --- a/fzf.gemspec +++ b/fzf.gemspec @@ -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}