.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "urxvt-selection-autotransform 1" .TH urxvt-selection-autotransform 1 2024-03-07 9.31 RXVT-UNICODE .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME selection\-autotransform \- automatically transform select text .SH DESCRIPTION .IX Header "DESCRIPTION" This selection allows you to do automatic transforms on a selection whenever a selection is made. .PP It works by specifying perl snippets (most useful is a single \f(CW\*(C`s///\*(C'\fR operator) that modify \f(CW$_\fR as resources: .PP .Vb 3 \& URxvt.selection\-autotransform.0: transform \& URxvt.selection\-autotransform.1: transform \& ... .Ve .PP For example, the following will transform selections of the form \&\f(CW\*(C`filename:number\*(C'\fR, often seen in compiler messages, into \f(CWvi +$filename $word\fR: .PP .Vb 1 \& URxvt.selection\-autotransform.0: s/^([^:[:space:]]+):(\e\ed+):?$/vi +$2 \e\eQ$1\e\eE\e\ex0d/ .Ve .PP And this example matches the same,but replaces it with vi-commands you can paste directly into your (vi :) editor: .PP .Vb 1 \& URxvt.selection\-autotransform.0: s/^([^:[:space:]]+(\e\ed+):?$/:e \e\eQ$1\e\eE\e\ex0d:$2\e\ex0d/ .Ve .PP Of course, this can be modified to suit your needs and your editor :) .PP To expand the example above to typical perl error messages ("XXX at FILENAME line YYY."), you need a slightly more elaborate solution: .PP .Vb 2 \& URxvt.selection.pattern\-0: ( at .*? line \e\ed+[,.]) \& URxvt.selection\-autotransform.0: s/^ at (.*?) line (\e\ed+)[,.]$/:e \e\eQ$1\eE\e\ex0d:$2\e\ex0d/ .Ve .PP The first line tells the selection code to treat the unchanging part of every error message as a selection pattern, and the second line transforms the message into vi commands to load the file.