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