2 , ,--. --.-. ,--. ---. , ,
3 | | | | | | |--' | | | |
4 ' `--' ' ' ' `--' ' ' `--`
6 --------------------------------------------------------------------------------
8 --------------------------------------------------------------------------------
9 Filter lines form stdin with an interactive menu
11 I will hopefully write this in ANSI C some day... At least I
12 really wish I will ever be able to!
14 The goal is to learn (ANSI) C, and mostly to be able to do
15 interfaces like those of vimperator.
19 --------------------------------------------------------------------------------
21 I described them all in the man page. I will provide a screencast if I
22 come with something nice.
26 --------------------------------------------------------------------------------
28 I like the lines order to be preserved while matching. This can
29 be convenient to pipe a file through filter, moreover.
31 Spaces are considered as a '*' wildchar or '.*' regular
32 expression. All other characters are consecutive characters
33 to match. This is hence not a fuzzy matching. There are fzf
34 and the very good fzy for that
36 While numbers are displayed (-n option), the number typed at
37 the beginning of input match in priority these displayed numbers.
41 --------------------------------------------------------------------------------
42 Differences and similarity with vimperator input.
44 In adition to vimperator behavior, a count would be displayed
45 in top right hand corner of the current input line, not used as
46 the completion may be rather small. I will need a way to manage
47 long line in input anyway, because the case with long lines and
48 small screen _will_ occur.
50 In vimperator, there is a grayed text after the input,
51 corresponding to the completion. This is a nice feature and I
52 plan to do this: \033[1;0m can output gray text even it TTY.
54 The matched string should be highlighted in candidates.
56 The current candidate should be highlighted with '\033[7m' prevent
57 the matched string to appear liht yellow on white background.
59 It could be nice if the candidates could be loaded dynamically,
60 to act like `fzf` does. Because it look good, and I would not
61 have to wait find on ~ to find a file to select it.
65 --------------------------------------------------------------------------------
66 Example that can replicate advanced vimperator completion features
68 In vimperator, while space is pressed, it prompts for the next
69 input to enter, and still keep the current input onscreen.
70 Backspace delete the input.
72 This can be performed with filter:
74 By setting '-k' to a space, at every word, the completion
77 Then a new prompt is generated using the previous word as a prompt
79 By checking for the return value, and if it is >0 (there was
80 an error, the user cancelled (Ctrl + C) or pressed backspace at
81 the beginning of the line), then reiterate the previous prompt.
83 This then permits to select from a first level input (like
84 commands), then according to the command, select second level
85 input different for each command (like flags or 'empty'), and
86 then, select a third level input (like filename)...
90 --------------------------------------------------------------------------------
91 Very useful while making this software
93 Thank you to the respective authors, that taught me C by writing
96 - https://github.com/martanne/vis/blob/master/vis-menu.c
98 - https://github.com/charles-l/pep/blob/master/pep.c
100 - http://git.suckless.org/sandy/tree/sandy.c