Added a label separator. Only the part of the line before it is shown.
[selector.git] / selector.1
1 .TH "SELECTOR" "1"
2 .SH "NAME"
3 selector - A simple command line utility for dynamic pattern selection
4 .SH "SYNOPSIS"
5 .PP
6 \fBselector\fP [\fBoptions\fP] [<filename1> [<filename2> ...]]
7 .SH "DESCRIPTION"
8 .PP
9 \fBselector\fP is a command line utility for dynamic string
10 selection. As you type a list of strings separated by ";" or a regexp,
11 the display is updated in real time to show only the lines containing
12 all the said strings, or matching the regexp.
13
14 The main usage of selector is as an efficient search in the shell
15 command history. With the correct option, it will inject the selected
16 line into the virtual tty input buffer, hence allowing the user to
17 edit the line and execute it as a standard command.
18
19 Selector is also a good tool to test regexps.
20
21 .SH "KEYS"
22 .PP
23
24 Keys corresponding to ASCII codes between " " and "~" add a character
25 to the pattern string. The Backspace key, "^H" and "^?" delete the
26 character immediately on the left of the cursor, while the Delete key
27 and "^D" delete the character at cursor location.
28
29 The Up and Down cursor keys move the selected line accordingly, and
30 PageUp and PageDown move by ten lines. The Home and End key move to
31 the top and the bottom of the list respectively. The return key
32 selects the current line and exits.
33
34 The shortcuts "^A", "^E", "^U", and "^K" do somehow what they do in
35 readline, and you can exit selector without doing anything by either
36 interrupting the command with "^C" or by typing "^G" or the Escape
37 key.
38
39 The "^R" key switches between the standard multi-substring mode and
40 the regexp mode, and "^I" between the case-sensitive and
41 case-insensitive modes.
42
43 .SH "OPTIONS"
44 .IP "\fB-h\fP" 10
45 display help and exits
46 .IP "\fB-m\fP" 10
47 force the monochrome mode
48 .IP "\fB-i\fP" 10
49 inverse the order of the lines
50 .IP "\fB-b\fP" 10
51 remove the numeric prefix from bash history
52 .IP "\fB-z\fP" 10
53 remove the time prefix from zsh history
54 .IP "\fB-d\fP" 10
55 remove duplicated lines
56 .IP "\fB-e\fP" 10
57 start with the regexp mode activated
58 .IP "\fB-a\fP" 10
59 make the matching case sensitive
60 .IP "\fB-q\fP" 10
61 make a flash instead of a beep when there is an edition error
62 .IP "\fB--\fP" 10
63 state that all following arguments are filenames
64 .IP "\fB-t <title>\fP" 10
65 add a title in the modeline
66 .IP "\fB-c <fg modeline> <bg modeline> <fg highlight> <bg highlight>\fP" 10
67 select the modeline and highlight color numbers
68 .IP "\fB-v\fP" 10
69 inject the selected line into the tty input buffer
70 .IP "\fB-w\fP" 10
71 add ^Q between characters during tty injection to quote control characters
72 .IP "\fB-o <output filename>\fP" 10
73 write the selected line into the specified file
74 .IP "\fB-s <pattern separator>\fP" 10
75 specify the symbol to separate the substrings in the search pattern
76 .IP "\fB-x <label separator>\fP" 10
77 specify the symbol to separate the label from the rest of the line
78 .IP "\fB-l <max number of lines>\fP" 10
79 specify the maximum number of lines to take into account
80 .IP "\fB-f <input filename>\fP" 10
81 specify a file to search into (option kept for compatibility reasons)
82
83 .SH "EXAMPLES"
84
85 To use selector to search into your bash history, you can use
86
87 .B selector -d -i -b -v <(history)
88
89 .SH "KEY-BINDING IN BASH"
90
91 You can associate selector to a single key in bash by using the
92 command 'bind' in your bash initialization file. For instance, to
93 associate it to M-r (that is, the "Alt" and "r" key pressed together),
94 just add something like
95
96 bind '"\\C-[r":"\\C-a\\C-kselector -d -i -b -v <(history)\\C-m"'
97
98 in your ~/.bashrc.
99
100 Note that depending on the configuration of your system, the sequence
101 associated to the M-r key, which is here "C-[r", may differ. To figure
102 it out, simply press C-q followed by M-r in the console.
103
104 The control character "C-a" puts the cursor to the mostleft location,
105 "C-k" erases the current content of the readline buffer, and "C-m"
106 simulates the enter key.
107
108 .SH "BUGS"
109
110 There are modeline display problems if the pattern is too long. If a
111 line contains control characters, the returned line has been converted
112 to printable characters.
113
114 .SH "AUTHOR"
115 .PP
116 Written by Francois Fleuret <francois@fleuret.org>, and distributed
117 under a Creative Commons Attribution-Share Alike 3.0 License.