summaryrefslogtreecommitdiff
path: root/fzy.1
blob: e6eb3a14f0e8ed2d819a528a03e972ebe9cb4cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
.TH FZY 1 "2018-09-23" "fzy 1.0"
.SH NAME
fzy \- A fuzzy text selector menu for the terminal.
.SH SYNOPSIS
.B fzy
.IR [OPTION]...
.SH DESCRIPTION
.B fzy is a fuzzy text selector/file finder for the terminal using a search
similar to that of TextMate or CmdT.

fzy reads a list of newline-separated items from stdin to be displayed as a
menu in the terminal.
Upon pressing ENTER, the currently selected item is printed to stdout.

Entering text narrows the items using fuzzy matching. Results are sorted using
heuristics for the best match.

.SH OPTIONS
.TP
.BR \-l ", " \-\-lines =\fILINES\fR
How many lines of items to display. If unspecified, defaults to 10 lines.
.
.TP
.BR \-p ", " \-\-prompt =\fIPROMPT\fR
Input prompt (default: '> ')
.
.TP
.BR \-s ", " \-\-show-scores
Show the scores for each item.
.
.TP
.BR \-t ", " \-\-tty =\fITTY\fR
Use TTY instead of the default tty device (/dev/tty).
.
.TP
.BR \-q ", " \-\-query =\fIQUERY\fR
Use QUERY as the initial search query.
.
.TP
.BR \-e ", " \-\-show-matches =\fIQUERY\fR
Non-interactive mode. Print the matches in sorted order for QUERY to stdout.
.
.TP
.BR \-0 ", " \-\-read-null
Read input delimited by ASCII NUL characters.
.
.TP
.BR \-f ", " \-\-search-fields =\fISELECTOR\fR
Restrict search to these fields in the input lines. See the \fIFIELD
SELECTORS\fR section for the \fISELECTOR\fR syntax.
.
.TP
.BR \-F ", " \-\-output-fields =\fISELECTOR\fR
Output these fields from the input lines. See the \fIFIELD SELECTORS\fR section
for the \fISELECTOR\fR syntax.
.
.TP
.BR \-d ", " \-\-delimiter =\fIDELIM\fR
Use \fIDELIM\fR to split input lines into fields. This is used for the
\fB\-f\fR/\fB\-F\fR options. \fIDELIM\fR is a sequence of delimiter characters,
defaulting to space+TAB.
.
.TP
.BR \-h ", " \-\-help
Usage help.
.
.TP
.BR \-v ", " \-\-version
Usage help.
.
.SH KEYS
.
.TP
.BR "ENTER"
Print the selected item to stdout and exit
.TP
.BR "Ctrl+c, Ctrl+g, Esc"
Exit with status 1, without making a selection.
.TP
.BR "Up Arrow, Ctrl+p"
Select the previous item
.TP
.BR "Down Arrow, Ctrl+n"
Select the next item
.TP
Tab
Replace the current search string with the selected item
.TP
.BR "Backspace, Ctrl+h"
Delete the character before the cursor
.TP
.BR Ctrl+w
Delete the word before the cursor
.TP
.BR Ctrl+u
Delete the entire line
.
.SH FIELD SELECTORS
A field selector is a comma-separated list of zero or more ranges. Each range is
one of:
.IP \fIN\fR 8
the field with index \fIN\fR
.IP [\fIN\fR]:[\fIM\fR]
all fields from index \fIN\fR to index \fIM\fR (inclusive). If \fIN\fR is
omitted, it defaults to 0. If \fIM\fR is omitted, it defaults to -1.
.PP
Indices are zero-based, i.e. first field is 0, second is 1 etc. Negative
indices count from the end of the line, i.e. -1 is the last field, -2 is the
second to last, etc.
.
.SH USAGE EXAMPLES
.
.TP
.BR "ls | fzy"
Present a menu of items in the current directory
.TP
.BR "ls | fzy -l 25"
Same as above, but show 25 lines of items
.TP
.BR "vi $(find -type f | fzy)"
List files under the current directory and open the one selected in vi.
.TP
.BR "cd $(find -type d | fzy)"
Present all directories under current path, and change to the one selected.
.TP
.BR "ps aux | fzy | awk '{ print $2 }' | xargs kill"
List running processes, kill the selected process
.TP
.BR "git checkout $(git branch | cut -c 3- | fzy)"
Same as above, but switching git branches.
.SH AUTHOR
John Hawthorn <john.hawthorn@gmail.com>