mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-14 14:23:47 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae84d8c7a4 | ||
|
|
dbd627c38a | ||
|
|
d172c3ce03 | ||
|
|
9904f5354e |
39
README.md
39
README.md
@@ -59,6 +59,7 @@ usage: fzf [options]
|
||||
+i Case-sensitive match
|
||||
+c, --no-color Disable colors
|
||||
+2, --no-256 Disable 256-color
|
||||
--black Use black background
|
||||
--no-mouse Disable mouse
|
||||
|
||||
Environment variables
|
||||
@@ -290,34 +291,20 @@ a very large list of files, fzf is significantly faster and it does not block.
|
||||
Tips
|
||||
----
|
||||
|
||||
### Faster startup with `--disable-gems` options
|
||||
### Rendering issues
|
||||
|
||||
If you're running Ruby 1.9 or above, you can improve the startup time with
|
||||
`--disable-gems` option to Ruby.
|
||||
If you have any rendering issues, check the followings:
|
||||
|
||||
- `time ruby ~/bin/fzf -h`
|
||||
- 0.077 sec
|
||||
- `time ruby --disable-gems ~/bin/fzf -h`
|
||||
- 0.025 sec
|
||||
|
||||
You can define fzf function with the option as follows:
|
||||
|
||||
```sh
|
||||
fzf() {
|
||||
ruby --disable-gems ~/bin/fzf "$@"
|
||||
}
|
||||
export -f fzf
|
||||
```
|
||||
|
||||
However, this is automatically set up in your .bashrc and .zshrc if you use the
|
||||
bundled [install](https://github.com/junegunn/fzf/blob/master/install) script.
|
||||
|
||||
### Incorrect display on Ruby 1.8
|
||||
|
||||
It is reported that the output of fzf can become unreadable on some terminals
|
||||
when it's running on Ruby 1.8. If you experience the problem, upgrade your Ruby
|
||||
to 1.9 or above. Ruby 1.9 or above is also required for displaying Unicode
|
||||
characters.
|
||||
1. Make sure `$TERM` is correctly set. fzf will use 256-color only if it
|
||||
contains `256` (e.g. `xterm-256color`)
|
||||
2. If you're on screen or tmux, `$TERM` should be either `screen` or
|
||||
`screen-256color`
|
||||
3. Some terminal emulators (e.g. mintty) have problem displaying default
|
||||
background color and make some text unable to read. In that case, try `--black`
|
||||
option. And if it solves your problem, I recommend including it in
|
||||
`FZF_DEFAULT_OPTS` for further convenience.
|
||||
4. If you still have problem, try `--no-256` option or even `--no-color`.
|
||||
5. Ruby 1.9 or above is required for correctly displaying unicode characters.
|
||||
|
||||
### Ranking algorithm
|
||||
|
||||
|
||||
10
fzf
10
fzf
@@ -7,7 +7,7 @@
|
||||
# / __/ / /_/ __/
|
||||
# /_/ /___/_/ Fuzzy finder for your shell
|
||||
#
|
||||
# Version: 0.8.0 (March 8, 2014)
|
||||
# Version: 0.8.1 (March 9, 2014)
|
||||
#
|
||||
# Author: Junegunn Choi
|
||||
# URL: https://github.com/junegunn/fzf
|
||||
@@ -50,7 +50,7 @@ end
|
||||
|
||||
class FZF
|
||||
C = Curses
|
||||
attr_reader :rxflag, :sort, :color, :ansi256, :mouse, :multi, :query, :filter, :extended
|
||||
attr_reader :rxflag, :sort, :color, :black, :ansi256, :mouse, :multi, :query, :filter, :extended
|
||||
|
||||
class AtomicVar
|
||||
def initialize value
|
||||
@@ -78,6 +78,7 @@ class FZF
|
||||
@sort = ENV.fetch('FZF_DEFAULT_SORT', 1000).to_i
|
||||
@color = true
|
||||
@ansi256 = true
|
||||
@black = false
|
||||
@multi = false
|
||||
@mouse = true
|
||||
@extended = nil
|
||||
@@ -104,6 +105,8 @@ class FZF
|
||||
when '+c', '--no-color' then @color = false
|
||||
when '-2', '--256' then @ansi256 = true
|
||||
when '+2', '--no-256' then @ansi256 = false
|
||||
when '--black' then @black = true
|
||||
when '--no-black' then @black = false
|
||||
when '--mouse' then @mouse = true
|
||||
when '--no-mouse' then @mouse = false
|
||||
when '+s', '--no-sort' then @sort = nil
|
||||
@@ -211,6 +214,7 @@ class FZF
|
||||
+i Case-sensitive match
|
||||
+c, --no-color Disable colors
|
||||
+2, --no-256 Disable 256-color
|
||||
--black Use black background
|
||||
--no-mouse Disable mouse
|
||||
|
||||
Environment variables
|
||||
@@ -517,7 +521,7 @@ class FZF
|
||||
C.mousemask C::ALL_MOUSE_EVENTS if @mouse
|
||||
C.start_color
|
||||
dbg =
|
||||
if C.respond_to?(:use_default_colors)
|
||||
if !@black && C.respond_to?(:use_default_colors)
|
||||
C.use_default_colors
|
||||
-1
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# coding: utf-8
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = 'fzf'
|
||||
spec.version = '0.8.0'
|
||||
spec.version = '0.8.1'
|
||||
spec.authors = ['Junegunn Choi']
|
||||
spec.email = ['junegunn.c@gmail.com']
|
||||
spec.description = %q{Fuzzy finder for your shell}
|
||||
|
||||
@@ -28,7 +28,7 @@ class TestFZF < MiniTest::Unit::TestCase
|
||||
fzf = FZF.new []
|
||||
assert_equal 20000, fzf.sort
|
||||
|
||||
ENV['FZF_DEFAULT_OPTS'] = '-x -m -s 10000 -q " hello world " +c +2 --no-mouse -f "goodbye world"'
|
||||
ENV['FZF_DEFAULT_OPTS'] = '-x -m -s 10000 -q " hello world " +c +2 --no-mouse -f "goodbye world" --black'
|
||||
fzf = FZF.new []
|
||||
assert_equal 10000, fzf.sort
|
||||
assert_equal ' hello world ',
|
||||
@@ -39,6 +39,7 @@ class TestFZF < MiniTest::Unit::TestCase
|
||||
assert_equal true, fzf.multi
|
||||
assert_equal false, fzf.color
|
||||
assert_equal false, fzf.ansi256
|
||||
assert_equal true, fzf.black
|
||||
assert_equal false, fzf.mouse
|
||||
end
|
||||
|
||||
@@ -50,6 +51,7 @@ class TestFZF < MiniTest::Unit::TestCase
|
||||
assert_equal true, fzf.multi
|
||||
assert_equal false, fzf.color
|
||||
assert_equal false, fzf.ansi256
|
||||
assert_equal false, fzf.black
|
||||
assert_equal false, fzf.mouse
|
||||
assert_equal 0, fzf.rxflag
|
||||
assert_equal 'hello', fzf.query.get
|
||||
@@ -57,12 +59,13 @@ class TestFZF < MiniTest::Unit::TestCase
|
||||
assert_equal :exact, fzf.extended
|
||||
|
||||
fzf = FZF.new %w[--sort=2000 --no-color --multi +i --query hello
|
||||
--filter a --filter b --no-256
|
||||
--filter a --filter b --no-256 --black
|
||||
--no-sort -i --color --no-multi --256]
|
||||
assert_equal nil, fzf.sort
|
||||
assert_equal false, fzf.multi
|
||||
assert_equal true, fzf.color
|
||||
assert_equal true, fzf.ansi256
|
||||
assert_equal true, fzf.black
|
||||
assert_equal true, fzf.mouse
|
||||
assert_equal 1, fzf.rxflag
|
||||
assert_equal 'b', fzf.filter
|
||||
@@ -82,11 +85,12 @@ class TestFZF < MiniTest::Unit::TestCase
|
||||
|
||||
# Left-to-right
|
||||
fzf = FZF.new %w[-s 2000 +c -m +i -qhello -x -fgoodbye +2
|
||||
-s 3000 -c +m -i -q world +x -fworld -2]
|
||||
-s 3000 -c +m -i -q world +x -fworld -2 --black --no-black]
|
||||
assert_equal 3000, fzf.sort
|
||||
assert_equal false, fzf.multi
|
||||
assert_equal true, fzf.color
|
||||
assert_equal true, fzf.ansi256
|
||||
assert_equal false, fzf.black
|
||||
assert_equal 1, fzf.rxflag
|
||||
assert_equal 'world', fzf.query.get
|
||||
assert_equal 'world', fzf.filter
|
||||
|
||||
Reference in New Issue
Block a user