--- rxvt-unicode/src/perl/matcher 2012/06/10 13:58:05 1.9 +++ rxvt-unicode/src/perl/matcher 2012/06/10 17:31:53 1.10 @@ -9,6 +9,43 @@ #:META:X_RESOURCE:%.launcher.:string:custom launcher for pattern #:META:X_RESOURCE:%.rend.:string:custom rednition for pattern +=head1 NAME + + matcher - match strings in terminal output and change their rendition + +=head1 DESCRPTION + +Uses per-line display filtering (C) to underline text +matching a certain pattern and make it clickable. When clicked with the +mouse button specified in the C resource (default 2, or +middle), the program specified in the C resource +(default, the C resource, C) will be started +with the matched text as first argument. The default configuration is +suitable for matching URLs and launching a web browser, like the +former "mark-urls" extension. + +The default pattern to match URLs can be overridden with the +C resource, and additional patterns can be specified +with numbered patterns, in a manner similar to the "selection" extension. +The launcher can also be overridden on a per-pattern basis. + +It is possible to activate the most recently seen match or a list of matches +from the keyboard. Simply bind a keysym to "perl:matcher:last" or +"perl:matcher:list" as seen in the example below. + +Example configuration: + + URxvt.perl-ext: default,matcher + URxvt.url-launcher: sensible-browser + URxvt.keysym.C-Delete: perl:matcher:last + URxvt.keysym.M-Delete: perl:matcher:list + URxvt.matcher.button: 1 + URxvt.matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-] + URxvt.matcher.pattern.2: \\B(/\\S+?):(\\d+)(?=:|$) + URxvt.matcher.launcher.2: gvim +$2 $1 + +=cut + my $url = qr{ (?:https?://|ftp://|news://|mailto:|file://|\bwww\.)