ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/doc/rxvtperl.3.txt
(Generate patch)

Comparing rxvt-unicode/doc/rxvtperl.3.txt (file contents):
Revision 1.19 by root, Tue Jan 10 19:46:28 2006 UTC vs.
Revision 1.26 by root, Fri Jan 13 01:09:37 2006 UTC

31 31
32 rxvt -pe <extensionname> 32 rxvt -pe <extensionname>
33 33
34 selection (enabled by default) 34 selection (enabled by default)
35 (More) intelligent selection. This extension tries to be more 35 (More) intelligent selection. This extension tries to be more
36 intelligent when the user extends selections (double-click). Right 36 intelligent when the user extends selections (double-click and
37 now, it tries to select urls and complete shell-quoted arguments, 37 further clicks). Right now, it tries to select words, urls and
38 which is very convenient, too, if your ls supports 38 complete shell-quoted arguments, which is very convenient, too, if
39 "--quoting-style=shell". 39 your ls supports "--quoting-style=shell".
40 40
41 A double-click usually selects the word under the cursor, further
42 clicks will enlarge the selection.
43
44 The selection works by trying to match a number of regexes and
45 displaying them in increasing order of length. You can add your own
46 regexes by specifying resources of the form:
47
48 URxvt.selection.pattern-0: perl-regex
49 URxvt.selection.pattern-1: perl-regex
50 ...
51
52 The index number (0, 1...) must not have any holes, and each regex
53 must contain at least one pair of capturing parentheses, which will
54 be used for the match. For example, the followign adds a regex that
55 matches everything between two vertical bars:
56
57 URxvt.selection.pattern-0: \\|([^|]+)\\|
58
59 You can look at the source of the selection extension to see more
60 interesting uses, such as parsing a line from beginning to end.
61
41 It also offers the following bindable keyboard command: 62 This extension also offers the following bindable keyboard command:
42 63
43 rot13 64 rot13
44 Rot-13 the selection when activated. Used via keyboard trigger: 65 Rot-13 the selection when activated. Used via keyboard trigger:
45 66
46 URxvt.keysym.C-M-r: perl:selection:rot13 67 URxvt.keysym.C-M-r: perl:selection:rot13
55 unescaping, perl evalution, web-browser starting etc.), depending on 76 unescaping, perl evalution, web-browser starting etc.), depending on
56 content. 77 content.
57 78
58 searchable-scrollback<hotkey> (enabled by default) 79 searchable-scrollback<hotkey> (enabled by default)
59 Adds regex search functionality to the scrollback buffer, triggered 80 Adds regex search functionality to the scrollback buffer, triggered
60 by a hotkey (default: "M-s"). When in search mode, normal terminal 81 by a hotkey (default: "M-s"). While in search mode, normal terminal
61 input/output is suspended. 82 input/output is suspended and a regex is displayed at the bottom of
83 the screen.
62 84
63 "/" starts an incremental regex search, "n" searches further, "p" or 85 Inputting characters appends them to the regex and continues
64 "N" jump to the previous match, "G" jumps to the bottom and clears 86 incremental search. "BackSpace" removes a character from the regex,
65 the history, "enter" leaves search mode at the current position and 87 "Up" and "Down" search upwards/downwards in the scrollback buffer,
66 "escape" returns to the original position. 88 "End" jumps to the bottom. "Escape" leaves search mode and returns
89 to the point where search was started, while "Enter" or "Return"
90 stay at the current position and additionally stores the first match
91 in the current line into the primary selection.
67 92
68 digital-clock 93 selection-autotransform
69 Displays a digital clock using the built-in overlay. 94 This selection allows you to do automatic transforms on a selection
95 whenever a selection is made.
96
97 It works by specifying perl snippets (most useful is a single "s///"
98 operator) that modify $_ as resources:
99
100 URxvt.selection-autotransform.0: transform
101 URxvt.selection-autotransform.1: transform
102 ...
103
104 For example, the following will transform selections of the form
105 "filename:number", often seen in compiler messages, into "vi
106 +$filename $word":
107
108 URxvt.selection-autotransform.0: s/^(\\S+):(\\d+):?$/vi +$2 \\Q$1\\E\\x0d/
109
110 And this example matches the same,but replaces it with vi-commands
111 you can paste directly into your (vi :) editor:
112
113 URxvt.selection-autotransform.0: s/^(S+):(d+):?$/\\x1b:e \\Q$1\\E\\x0d:$2\\x0d/
114
115 Of course, this can be modified to suit your needs and your editor
116 :)
117
118 To expand the example above to typical perl error messages ("XXX at
119 FILENAME line YYY."), you need a slightly more elaborate solution:
120
121 URxvt.selection.pattern-0: ( at .*? line \\d+\\.)
122 URxvt.selection-autotransform.0: s/^ at (.*?) line (\\d+)\\.$/\x1b:e \\Q$1\E\\x0d:$2\\x0d/
123
124 The first line tells the selection code to treat the unchanging part
125 of every error message as a selection pattern, and the second line
126 transforms the message into vi commands to load the file.
70 127
71 mark-urls 128 mark-urls
72 Uses per-line display filtering ("on_line_update") to underline 129 Uses per-line display filtering ("on_line_update") to underline urls
73 urls. 130 and make them clickable. When middle-clicked, the program specified
131 in the resource "urlLauncher" (default "x-www-browser") will be
132 started with the URL as first argument.
74 133
75 block-graphics-to-ascii 134 block-graphics-to-ascii
76 A not very useful example of filtering all text output to the 135 A not very useful example of filtering all text output to the
77 terminal, by replacing all line-drawing characters (U+2500 .. 136 terminal, by replacing all line-drawing characters (U+2500 ..
78 U+259F) by a similar-looking ascii character. 137 U+259F) by a similar-looking ascii character.
138
139 digital-clock
140 Displays a digital clock using the built-in overlay.
79 141
80 example-refresh-hooks 142 example-refresh-hooks
81 Displays a very simple digital clock in the upper right corner of 143 Displays a very simple digital clock in the upper right corner of
82 the window. Illustrates overwriting the refresh callbacks to create 144 the window. Illustrates overwriting the refresh callbacks to create
83 your own overlays or changes. 145 your own overlays or changes.
98 Argument names also often indicate the type of a parameter. Here are 160 Argument names also often indicate the type of a parameter. Here are
99 some hints on what they mean: 161 some hints on what they mean:
100 162
101 $text 163 $text
102 Rxvt-unicodes special way of encoding text, where one "unicode" 164 Rxvt-unicodes special way of encoding text, where one "unicode"
103 character always represents one screen cell. See row_t for a 165 character always represents one screen cell. See ROW_t for a
104 discussion of this format. 166 discussion of this format.
105 167
106 $string 168 $string
107 A perl text string, with an emphasis on *text*. It can store all 169 A perl text string, with an emphasis on *text*. It can store all
108 unicode characters and is to be distinguished with text encoded in a 170 unicode characters and is to be distinguished with text encoded in a
186 248
187 on_sel_extend $term 249 on_sel_extend $term
188 Called whenever the user tries to extend the selection (e.g. with a 250 Called whenever the user tries to extend the selection (e.g. with a
189 double click) and is either supposed to return false (normal 251 double click) and is either supposed to return false (normal
190 operation), or should extend the selection itelf and return true to 252 operation), or should extend the selection itelf and return true to
191 suppress the built-in processing. 253 suppress the built-in processing. This can happen multiple times, as
254 long as the callback returns true, it will be called on every
255 further click by the user and is supposed to enlarge the selection
256 more and more, if possible.
192 257
193 See the selection example extension. 258 See the selection example extension.
194 259
195 on_view_change $term, $offset 260 on_view_change $term, $offset
196 Called whenever the view offset changes, i..e the user or program 261 Called whenever the view offset changes, i..e the user or program
299 364
300 $urxvt::TERM 365 $urxvt::TERM
301 The current terminal. This variable stores the current "urxvt::term" 366 The current terminal. This variable stores the current "urxvt::term"
302 object, whenever a callback/hook is executing. 367 object, whenever a callback/hook is executing.
303 368
304 *
305
306 Functions in the "urxvt" Package 369 Functions in the "urxvt" Package
307 $term = new urxvt [arg...]
308 Creates a new terminal, very similar as if you had started it with
309 "system $binfile, arg...". Croaks (and probably outputs an error
310 message) if the new instance couldn't be created. Returns "undef" if
311 the new instance didn't initialise perl, and the terminal object
312 otherwise. The "init" and "start" hooks will be called during the
313 call.
314
315 urxvt::fatal $errormessage 370 urxvt::fatal $errormessage
316 Fatally aborts execution with the given error message. Avoid at all 371 Fatally aborts execution with the given error message. Avoid at all
317 costs! The only time this is acceptable is when the terminal process 372 costs! The only time this is acceptable is when the terminal process
318 starts up. 373 starts up.
319 374
322 newline. The module also overwrites the "warn" builtin with a 377 newline. The module also overwrites the "warn" builtin with a
323 function that calls this function. 378 function that calls this function.
324 379
325 Using this function has the advantage that its output ends up in the 380 Using this function has the advantage that its output ends up in the
326 correct place, e.g. on stderr of the connecting urxvtc client. 381 correct place, e.g. on stderr of the connecting urxvtc client.
382
383 Messages have a size limit of 1023 bytes currently.
327 384
328 $is_safe = urxvt::safe 385 $is_safe = urxvt::safe
329 Returns true when it is safe to do potentially unsafe things, such 386 Returns true when it is safe to do potentially unsafe things, such
330 as evaluating perl code specified by the user. This is true when 387 as evaluating perl code specified by the user. This is true when
331 urxvt was started setuid or setgid. 388 urxvt was started setuid or setgid.
385 condition variables, but non-blocking condvar use is ok. What this means 442 condition variables, but non-blocking condvar use is ok. What this means
386 is that you cannot use blocking APIs, but the non-blocking variant 443 is that you cannot use blocking APIs, but the non-blocking variant
387 should work. 444 should work.
388 445
389 The "urxvt::term" Class 446 The "urxvt::term" Class
447 $term = new urxvt::term $envhashref, $rxvtname, [arg...]
448 Creates a new terminal, very similar as if you had started it with
449 system "$rxvtname, arg...". $envhashref must be a reference to a
450 %ENV-like hash which defines the environment of the new terminal.
451
452 Croaks (and probably outputs an error message) if the new instance
453 couldn't be created. Returns "undef" if the new instance didn't
454 initialise perl, and the terminal object otherwise. The "init" and
455 "start" hooks will be called during this call.
456
390 $term->destroy 457 $term->destroy
391 Destroy the terminal object (close the window, free resources etc.). 458 Destroy the terminal object (close the window, free resources etc.).
392 Please note that rxvt will not exit as long as any event watchers 459 Please note that rxvt will not exit as long as any event watchers
393 (timers, io watchers) are still active. 460 (timers, io watchers) are still active.
394 461
440 scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput 507 scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput
441 scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle 508 scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle
442 shade term_name title transparent transparent_all tripleclickwords 509 shade term_name title transparent transparent_all tripleclickwords
443 utmpInhibit visualBell 510 utmpInhibit visualBell
444 511
512 $value = $term->x_resource ($pattern)
513 Returns the X-Resource for the given pattern, excluding the program
514 or class name, i.e. "$term->x_resource ("boldFont")" should return
515 the same value as used by this instance of rxvt-unicode. Returns
516 "undef" if no resource with that pattern exists.
517
518 This method should only be called during the "on_start" hook, as
519 there is only one resource database per display, and later
520 invocations might return the wrong resources.
521
445 $success = $term->parse_keysym ($keysym_spec, $command_string) 522 $success = $term->parse_keysym ($keysym_spec, $command_string)
446 Adds a keymap translation exactly as specified via a resource. See 523 Adds a keymap translation exactly as specified via a resource. See
447 the "keysym" resource in the rxvt(1) manpage. 524 the "keysym" resource in the rxvt(1) manpage.
448 525
449 $rend = $term->rstyle ([$new_rstyle]) 526 $rend = $term->rstyle ([$new_rstyle])
459 ($row, $col) = $term->selection_beg ([$row, $col]) 536 ($row, $col) = $term->selection_beg ([$row, $col])
460 ($row, $col) = $term->selection_end ([$row, $col]) 537 ($row, $col) = $term->selection_end ([$row, $col])
461 Return the current values of the selection mark, begin or end 538 Return the current values of the selection mark, begin or end
462 positions, and optionally set them to new values. 539 positions, and optionally set them to new values.
463 540
541 $term->selection_make ($eventtime[, $rectangular])
542 Tries to make a selection as set by "selection_beg" and
543 "selection_end". If $rectangular is true (default: false), a
544 rectangular selection will be made. This is the prefered function to
545 make a selection.
546
464 $success = $term->selection_grab ($eventtime) 547 $success = $term->selection_grab ($eventtime)
465 Try to request the primary selection from the server (for example, 548 Try to request the primary selection text from the server (for
466 as set by the next method). 549 example, as set by the next method). No visual feedback will be
550 given. This function is mostly useful from within "on_sel_grab"
551 hooks.
467 552
468 $oldtext = $term->selection ([$newtext]) 553 $oldtext = $term->selection ([$newtext])
469 Return the current selection text and optionally replace it by 554 Return the current selection text and optionally replace it by
470 $newtext. 555 $newtext.
471 556
516 $string = $term->locale_decode ($octets) 601 $string = $term->locale_decode ($octets)
517 Convert the given locale-encoded octets into a perl string. 602 Convert the given locale-encoded octets into a perl string.
518 603
519 $term->scr_xor_span ($beg_row, $beg_col, $end_row, $end_col[, $rstyle]) 604 $term->scr_xor_span ($beg_row, $beg_col, $end_row, $end_col[, $rstyle])
520 XORs the rendition values in the given span with the provided value 605 XORs the rendition values in the given span with the provided value
521 (default: "RS_RVid"). Useful in refresh hooks to provide effects 606 (default: "RS_RVid"), which *MUST NOT* contain font styles. Useful
522 similar to the selection. 607 in refresh hooks to provide effects similar to the selection.
523 608
524 $term->scr_xor_rect ($beg_row, $beg_col, $end_row, $end_col[, $rstyle1[, 609 $term->scr_xor_rect ($beg_row, $beg_col, $end_row, $end_col[, $rstyle1[,
525 $rstyle2]]) 610 $rstyle2]])
526 Similar to "scr_xor_span", but xors a rectangle instead. Trailing 611 Similar to "scr_xor_span", but xors a rectangle instead. Trailing
527 whitespace will additionally be xored with the $rstyle2, which 612 whitespace will additionally be xored with the $rstyle2, which
528 defaults to "RS_RVid | RS_Uline", which removes reverse video again 613 defaults to "RS_RVid | RS_Uline", which removes reverse video again
529 and underlines it instead. 614 and underlines it instead. Both styles *MUST NOT* contain font
615 styles.
530 616
531 $term->scr_bell 617 $term->scr_bell
532 Ring the bell! 618 Ring the bell!
533 619
534 $term->scr_add_lines ($string) 620 $term->scr_add_lines ($string)
577 $max_scrollback = $term->saveLines 663 $max_scrollback = $term->saveLines
578 $nrow_plus_saveLines = $term->total_rows 664 $nrow_plus_saveLines = $term->total_rows
579 $lines_in_scrollback = $term->nsaved 665 $lines_in_scrollback = $term->nsaved
580 Return various integers describing terminal characteristics. 666 Return various integers describing terminal characteristics.
581 667
668 $x_display = $term->display_id
669 Return the DISPLAY used by rxvt-unicode.
670
582 $lc_ctype = $term->locale 671 $lc_ctype = $term->locale
583 Returns the LC_CTYPE category string used by this rxvt-unicode. 672 Returns the LC_CTYPE category string used by this rxvt-unicode.
584 673
585 $x_display = $term->display_id 674 $env = $term->env
586 Return the DISPLAY used by rxvt-unicode. 675 Returns a copy of the environment in effect for the terminal as a
676 hashref similar to "\%ENV".
587 677
588 $modifiermask = $term->ModLevel3Mask 678 $modifiermask = $term->ModLevel3Mask
589 $modifiermask = $term->ModMetaMask 679 $modifiermask = $term->ModMetaMask
590 $modifiermask = $term->ModNumLockMask 680 $modifiermask = $term->ModNumLockMask
591 Return the modifier masks corresponding to the "ISO Level 3 Shift" 681 Return the modifier masks corresponding to the "ISO Level 3 Shift"
670 Return the row number of the first/last row of the line, 760 Return the row number of the first/last row of the line,
671 respectively. 761 respectively.
672 762
673 $offset = $line->offset_of ($row, $col) 763 $offset = $line->offset_of ($row, $col)
674 Returns the character offset of the given row|col pair within 764 Returns the character offset of the given row|col pair within
675 the logical line. 765 the logical line. Works for rows outside the line, too, and
766 returns corresponding offsets outside the string.
676 767
677 ($row, $col) = $line->coord_of ($offset) 768 ($row, $col) = $line->coord_of ($offset)
678 Translates a string offset into terminal coordinates again. 769 Translates a string offset into terminal coordinates again.
679 770
680 $text = $term->special_encode $string 771 $text = $term->special_encode $string
727 818
728 $popup->show 819 $popup->show
729 Displays the popup (which is initially hidden). 820 Displays the popup (which is initially hidden).
730 821
731 The "urxvt::timer" Class 822 The "urxvt::timer" Class
732 This class implements timer watchers/events. Time is represented as 823 This class implements timer watchers/events. Time is represented as a
733 a fractional number of seconds since the epoch. Example: 824 fractional number of seconds since the epoch. Example:
734 825
735 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); 826 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
736 $term->{timer} = urxvt::timer 827 $term->{timer} = urxvt::timer
737 ->new 828 ->new
738 ->interval (1) 829 ->interval (1)
739 ->cb (sub { 830 ->cb (sub {
740 $term->{overlay}->set (0, 0, 831 $term->{overlay}->set (0, 0,
741 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); 832 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
742 }); 833 });
743 834
744 $timer = new urxvt::timer 835 $timer = new urxvt::timer
745 Create a new timer object in started state. It is scheduled to 836 Create a new timer object in started state. It is scheduled to fire
746 fire immediately. 837 immediately.
747 838
748 $timer = $timer->cb (sub { my ($timer) = @_; ... }) 839 $timer = $timer->cb (sub { my ($timer) = @_; ... })
749 Set the callback to be called when the timer triggers. 840 Set the callback to be called when the timer triggers.
750 841
751 $tstamp = $timer->at 842 $tstamp = $timer->at
752 Return the time this watcher will fire next. 843 Return the time this watcher will fire next.
753 844
754 $timer = $timer->set ($tstamp) 845 $timer = $timer->set ($tstamp)
755 Set the time the event is generated to $tstamp. 846 Set the time the event is generated to $tstamp.
756 847
757 $timer = $timer->interval ($interval) 848 $timer = $timer->interval ($interval)
758 Normally (and when $interval is 0), the timer will automatically 849 Normally (and when $interval is 0), the timer will automatically
759 stop after it has fired once. If $interval is non-zero, then the 850 stop after it has fired once. If $interval is non-zero, then the
760 timer is automatically rescheduled at the given intervals. 851 timer is automatically rescheduled at the given intervals.
761 852
762 $timer = $timer->start 853 $timer = $timer->start
763 Start the timer. 854 Start the timer.
764 855
765 $timer = $timer->start ($tstamp) 856 $timer = $timer->start ($tstamp)
766 Set the event trigger time to $tstamp and start the timer. 857 Set the event trigger time to $tstamp and start the timer.
767 858
768 $timer = $timer->stop 859 $timer = $timer->stop
769 Stop the timer. 860 Stop the timer.
770 861
771 The "urxvt::iow" Class 862 The "urxvt::iow" Class
772 This class implements io watchers/events. Example: 863 This class implements io watchers/events. Example:
773 864
774 $term->{socket} = ... 865 $term->{socket} = ...
775 $term->{iow} = urxvt::iow 866 $term->{iow} = urxvt::iow
776 ->new 867 ->new
777 ->fd (fileno $term->{socket}) 868 ->fd (fileno $term->{socket})
778 ->events (urxvt::EVENT_READ) 869 ->events (urxvt::EVENT_READ)
779 ->start 870 ->start
780 ->cb (sub { 871 ->cb (sub {
781 my ($iow, $revents) = @_; 872 my ($iow, $revents) = @_;
782 # $revents must be 1 here, no need to check 873 # $revents must be 1 here, no need to check
783 sysread $term->{socket}, my $buf, 8192 874 sysread $term->{socket}, my $buf, 8192
784 or end-of-file; 875 or end-of-file;
785 }); 876 });
786 877
787 $iow = new urxvt::iow 878 $iow = new urxvt::iow
788 Create a new io watcher object in stopped state. 879 Create a new io watcher object in stopped state.
789 880
790 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) 881 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })
791 Set the callback to be called when io events are triggered. 882 Set the callback to be called when io events are triggered.
792 $reventmask is a bitset as described in the "events" method. 883 $reventmask is a bitset as described in the "events" method.
793 884
794 $iow = $iow->fd ($fd) 885 $iow = $iow->fd ($fd)
795 Set the filedescriptor (not handle) to watch. 886 Set the filedescriptor (not handle) to watch.
796 887
797 $iow = $iow->events ($eventmask) 888 $iow = $iow->events ($eventmask)
798 Set the event mask to watch. The only allowed values are 889 Set the event mask to watch. The only allowed values are
799 "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be 890 "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be ORed
800 ORed together, or "urxvt::EVENT_NONE". 891 together, or "urxvt::EVENT_NONE".
801 892
802 $iow = $iow->start 893 $iow = $iow->start
803 Start watching for requested events on the given handle. 894 Start watching for requested events on the given handle.
804 895
805 $iow = $iow->stop 896 $iow = $iow->stop
806 Stop watching for events on the given filehandle. 897 Stop watching for events on the given filehandle.
807 898
808ENVIRONMENT 899ENVIRONMENT
809 URXVT_PERL_VERBOSITY 900 URXVT_PERL_VERBOSITY
810 This variable controls the verbosity level of the perl extension. 901 This variable controls the verbosity level of the perl extension. Higher
811 Higher numbers indicate more verbose output. 902 numbers indicate more verbose output.
812 903
813 == 0 - fatal messages 904 == 0 - fatal messages
814 >= 3 - script loading and management 905 >= 3 - script loading and management
815 >=10 - all events received 906 >=10 - all called hooks
907 >=11 - hook reutrn values
816 908
817AUTHOR 909AUTHOR
818 Marc Lehmann <pcg@goof.com> 910 Marc Lehmann <pcg@goof.com>
819 http://software.schmorp.de/pkg/rxvt-unicode 911 http://software.schmorp.de/pkg/rxvt-unicode
820 912

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines