-
Notifications
You must be signed in to change notification settings - Fork 42
/
pick.1
131 lines (131 loc) · 3.79 KB
/
pick.1
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
.Dd August 17, 2014
.Dt PICK 1
.Os
.Sh NAME
.Nm pick
.Nd fuzzy select anything
.Sh SYNOPSIS
.Nm
.Op Fl dKoSXx
.Op Fl q Ar query
.Sh DESCRIPTION
The
.Nm
utility allows users to select from a set of choices using an
.Xr curses 3
interface with fuzzy search functionality.
.Pp
The choices are read from
.Pa stdin ,
and the selected choice written to
.Pa stdout .
.Pp
The options are as follows:
.Bl -tag -width "-q query"
.It Fl d
Read and display descriptions.
Input lines will be split into two parts by the last occurrence of
.Ev IFS .
Both parts will be displayed but only the first part will be used when
searching.
.It Fl K
Disable toggling of keypad transmit mode.
Useful when running
.Nm
from within another interactive program which already has set the correct
transmit mode.
.It Fl o
Output description of selected choice on exit.
.It Fl q Ar query
Supply an initial search query.
.It Fl S
Disable sorting.
Only filter the choices instead of additionally sorting by score.
This option can be toggled from within the interface,
see
.Sx COMMANDS .
.It Fl x
Enable the use of the alternate screen terminal feature.
This is the default.
.It Fl X
Disable the use of the alternate screen terminal feature.
.El
.Sh COMMANDS
.Bl -tag -width XXXX
.It Ic Ctrl-C
Exit with a erroneous status without outputting the selected choice.
While this command often being defined as Ctrl-C it is determined by the
.Dv VINTR
control character,
see
.Xr termios 4 .
.It Ic Ctrl-L
Redraw interface with respect to the current size of the terminal.
.It Ic Ctrl-O
Toggle sorting.
.It Ic Up Ns / Ns Ic Down | Ic Ctrl-P Ns / Ns Ic Ctrl-N
Select between choices matching the current search query.
.It Ic Page-Down Ns / Ns Ic Page-Up | Ic Ctrl-V Ns / Ns Ic Alt-V | Ic Alt-Space
Move the selection to the choice located one page down/up from the currently
selected choice.
.It Ic Home Ns / Ns Ic End | Ic Alt-< Ns / Ns Ic Alt->
Move the selection to the first/last choice matching the current search query.
.It Ic Enter
Output the currently selected choice and exit.
.It Ic Alt-Enter
Output the current input query and exit.
.It Ic Left Ns / Ns Ic Right | Ic Ctrl-B Ns / Ns Ic Ctrl-F
Move the cursor left and right in the search query input field.
.It Ic Ctrl-A
Move the cursor to the beginning of the line in the search query input field.
.It Ic Ctrl-E
Move the cursor to the end of the line in the search query input field.
.It Ic Backspace | Ctrl-H
Delete one character to the left of the cursor in the search query input field.
.It Ic Delete | Ctrl-D
Delete the character under the cursor in the search query input field.
.It Ic Ctrl-W | Alt-Backspace
Delete the word to the left of the cursor.
A word is recognized as a sequence of characters for which either
.Xr isalnum 3
is true or the character is an underscore.
.It Ic Ctrl-U
Delete to the beginning of the line in the search query input field.
.It Ic Ctrl-K
Delete to the end of the line in the search query input field.
.It Ic Printable characters
Added to the search query and will refine the current search.
.El
.Sh ENVIRONMENT
The following environment variables will affect the execution of
.Nm pick :
.Bl -tag -width IFS
.It Ev IFS
Determines the separator used between choices and descriptions.
.El
.Sh ASYNCHRONOUS EVENTS
.Bl -tag -width "SIGWINCH"
.It Dv SIGWINCH
The screen is resized.
.El
.Sh EXAMPLES
Select a file in the current directory to open using
.Xr xdg-open 1 :
.Pp
.Dl $ find \&. -type f | pick | xargs xdg-open
.Pp
Select a command from the history to execute:
.Pp
.Dl $ eval $(fc -ln 1 | pick)
.Sh DIAGNOSTICS
.Ex -std
.Sh HISTORY
The first version of
.Nm
was released on August 18, 2014.
Development was sponsored by
.Lk https://thoughtbot.com thoughtbot
from the start of the project until September 2016.
.Sh AUTHORS
.An Calle Erlandsson Aq Mt calle@calleerlandsson.com
.An Anton Lindqvist Aq Mt anton@basename.se