1urxvt-matcher(1) RXVT-UNICODE urxvt-matcher(1)
2
3
4
6 matcher - match strings in terminal output and change their rendition
7
9 Uses per-line display filtering ("on_line_update") to underline text
10 matching a certain pattern and make it clickable. When clicked with the
11 mouse button specified in the "matcher.button" resource (default 2, or
12 middle), the program specified in the "matcher.launcher" resource
13 (default, the "url-launcher" resource, "sensible-browser") will be
14 started with the matched text as first argument. The default
15 configuration is suitable for matching URLs and launching a web
16 browser, like the former "mark-urls" extension.
17
18 The default pattern to match URLs can be overridden with the
19 "matcher.pattern.0" resource, and additional patterns can be specified
20 with numbered patterns, in a manner similar to the "selection"
21 extension. The launcher can also be overridden on a per-pattern basis.
22
23 It is possible to activate the most recently seen match or a list of
24 matches from the keyboard. Simply bind a keysym to "matcher:last" or
25 "matcher:list" as seen in the example below.
26
27 The "matcher:select" action enables a mode in which it is possible to
28 iterate over the matches using the keyboard and either activate them or
29 copy them to the clipboard. While the mode is active, normal terminal
30 input/output is suspended and the following bindings are recognized:
31
32 "Up"
33 Search for a match upwards.
34
35 "Down"
36 Search for a match downwards.
37
38 "Home"
39 Jump to the topmost match.
40
41 "End"
42 Jump to the bottommost match.
43
44 "Escape"
45 Leave the mode and return to the point where search was started.
46
47 "Enter"
48 Activate the current match.
49
50 "y" Copy the current match to the clipboard.
51
52 It is also possible to cycle through the matches using a key
53 combination bound to the "matcher:select" action.
54
55 Example: load and use the matcher extension with defaults.
56
57 URxvt.perl-ext: default,matcher
58
59 Example: use a custom configuration.
60
61 URxvt.url-launcher: sensible-browser
62 URxvt.keysym.C-Delete: matcher:last
63 URxvt.keysym.M-Delete: matcher:list
64 URxvt.matcher.button: 1
65 URxvt.matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-]
66 URxvt.matcher.pattern.2: \\B(/\\S+?):(\\d+)(?=:|$)
67 URxvt.matcher.launcher.2: gvim +$2 $1
68
69 Regex encoding/wide character matching
70 Urxvt stores all text as unicode, in a special encoding that uses one
71 character/code point per column. For various reasons, the regular
72 expressions are matched directly against this encoding, which means
73 there are a few things you need to keep in mind:
74
75 X resources/command line arguments are locale-encoded
76 The regexes taken from the command line or resources will be
77 converted from locale encoding to unicode. This can change the
78 number of code points per character.
79
80 Wide characters are column-padded with $urxvt::NOCHAR
81 Wide characters (such as kanji and sometimes tabs) are padded with
82 a special character value ($urxvt::NOCHAR). That means that
83 constructs such as "\w" or "." will only match part of a character,
84 as $urxvt::NOCHAR is not matched by "\w" and both only match the
85 first "column" of a wide character.
86
87 That means you have to incorporate $urxvt::NOCHAR into parts of
88 regexes that may match wide characters. For example, to match "\w+"
89 you might want to use "[\w$urxvt::NOCHAR]+" instead, and to match a
90 single character (".") you might want to use ".$urxvt::NOCHAR*"
91 instead.
92
93
94
959.31 2023-01-03 urxvt-matcher(1)