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.25 by root, Thu Jan 12 12:15:10 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 :)
70 117
71 mark-urls 118 mark-urls
72 Uses per-line display filtering ("on_line_update") to underline 119 Uses per-line display filtering ("on_line_update") to underline urls
73 urls. 120 and make them clickable. When middle-clicked, the program specified
121 in the resource "urlLauncher" (default "x-www-browser") will be
122 started with the URL as first argument.
74 123
75 block-graphics-to-ascii 124 block-graphics-to-ascii
76 A not very useful example of filtering all text output to the 125 A not very useful example of filtering all text output to the
77 terminal, by replacing all line-drawing characters (U+2500 .. 126 terminal, by replacing all line-drawing characters (U+2500 ..
78 U+259F) by a similar-looking ascii character. 127 U+259F) by a similar-looking ascii character.
128
129 digital-clock
130 Displays a digital clock using the built-in overlay.
79 131
80 example-refresh-hooks 132 example-refresh-hooks
81 Displays a very simple digital clock in the upper right corner of 133 Displays a very simple digital clock in the upper right corner of
82 the window. Illustrates overwriting the refresh callbacks to create 134 the window. Illustrates overwriting the refresh callbacks to create
83 your own overlays or changes. 135 your own overlays or changes.
98 Argument names also often indicate the type of a parameter. Here are 150 Argument names also often indicate the type of a parameter. Here are
99 some hints on what they mean: 151 some hints on what they mean:
100 152
101 $text 153 $text
102 Rxvt-unicodes special way of encoding text, where one "unicode" 154 Rxvt-unicodes special way of encoding text, where one "unicode"
103 character always represents one screen cell. See row_t for a 155 character always represents one screen cell. See ROW_t for a
104 discussion of this format. 156 discussion of this format.
105 157
106 $string 158 $string
107 A perl text string, with an emphasis on *text*. It can store all 159 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 160 unicode characters and is to be distinguished with text encoded in a
186 238
187 on_sel_extend $term 239 on_sel_extend $term
188 Called whenever the user tries to extend the selection (e.g. with a 240 Called whenever the user tries to extend the selection (e.g. with a
189 double click) and is either supposed to return false (normal 241 double click) and is either supposed to return false (normal
190 operation), or should extend the selection itelf and return true to 242 operation), or should extend the selection itelf and return true to
191 suppress the built-in processing. 243 suppress the built-in processing. This can happen multiple times, as
244 long as the callback returns true, it will be called on every
245 further click by the user and is supposed to enlarge the selection
246 more and more, if possible.
192 247
193 See the selection example extension. 248 See the selection example extension.
194 249
195 on_view_change $term, $offset 250 on_view_change $term, $offset
196 Called whenever the view offset changes, i..e the user or program 251 Called whenever the view offset changes, i..e the user or program
299 354
300 $urxvt::TERM 355 $urxvt::TERM
301 The current terminal. This variable stores the current "urxvt::term" 356 The current terminal. This variable stores the current "urxvt::term"
302 object, whenever a callback/hook is executing. 357 object, whenever a callback/hook is executing.
303 358
304 *
305
306 Functions in the "urxvt" Package 359 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 360 urxvt::fatal $errormessage
316 Fatally aborts execution with the given error message. Avoid at all 361 Fatally aborts execution with the given error message. Avoid at all
317 costs! The only time this is acceptable is when the terminal process 362 costs! The only time this is acceptable is when the terminal process
318 starts up. 363 starts up.
319 364
322 newline. The module also overwrites the "warn" builtin with a 367 newline. The module also overwrites the "warn" builtin with a
323 function that calls this function. 368 function that calls this function.
324 369
325 Using this function has the advantage that its output ends up in the 370 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. 371 correct place, e.g. on stderr of the connecting urxvtc client.
372
373 Messages have a size limit of 1023 bytes currently.
327 374
328 $is_safe = urxvt::safe 375 $is_safe = urxvt::safe
329 Returns true when it is safe to do potentially unsafe things, such 376 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 377 as evaluating perl code specified by the user. This is true when
331 urxvt was started setuid or setgid. 378 urxvt was started setuid or setgid.
385 condition variables, but non-blocking condvar use is ok. What this means 432 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 433 is that you cannot use blocking APIs, but the non-blocking variant
387 should work. 434 should work.
388 435
389 The "urxvt::term" Class 436 The "urxvt::term" Class
437 $term = new urxvt::term $envhashref, $rxvtname, [arg...]
438 Creates a new terminal, very similar as if you had started it with
439 system "$rxvtname, arg...". $envhashref must be a reference to a
440 %ENV-like hash which defines the environment of the new terminal.
441
442 Croaks (and probably outputs an error message) if the new instance
443 couldn't be created. Returns "undef" if the new instance didn't
444 initialise perl, and the terminal object otherwise. The "init" and
445 "start" hooks will be called during this call.
446
390 $term->destroy 447 $term->destroy
391 Destroy the terminal object (close the window, free resources etc.). 448 Destroy the terminal object (close the window, free resources etc.).
392 Please note that rxvt will not exit as long as any event watchers 449 Please note that rxvt will not exit as long as any event watchers
393 (timers, io watchers) are still active. 450 (timers, io watchers) are still active.
394 451
440 scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput 497 scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput
441 scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle 498 scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle
442 shade term_name title transparent transparent_all tripleclickwords 499 shade term_name title transparent transparent_all tripleclickwords
443 utmpInhibit visualBell 500 utmpInhibit visualBell
444 501
502 $value = $term->x_resource ($pattern)
503 Returns the X-Resource for the given pattern, excluding the program
504 or class name, i.e. "$term->x_resource ("boldFont")" should return
505 the same value as used by this instance of rxvt-unicode. Returns
506 "undef" if no resource with that pattern exists.
507
508 This method should only be called during the "on_start" hook, as
509 there is only one resource database per display, and later
510 invocations might return the wrong resources.
511
445 $success = $term->parse_keysym ($keysym_spec, $command_string) 512 $success = $term->parse_keysym ($keysym_spec, $command_string)
446 Adds a keymap translation exactly as specified via a resource. See 513 Adds a keymap translation exactly as specified via a resource. See
447 the "keysym" resource in the rxvt(1) manpage. 514 the "keysym" resource in the rxvt(1) manpage.
448 515
449 $rend = $term->rstyle ([$new_rstyle]) 516 $rend = $term->rstyle ([$new_rstyle])
459 ($row, $col) = $term->selection_beg ([$row, $col]) 526 ($row, $col) = $term->selection_beg ([$row, $col])
460 ($row, $col) = $term->selection_end ([$row, $col]) 527 ($row, $col) = $term->selection_end ([$row, $col])
461 Return the current values of the selection mark, begin or end 528 Return the current values of the selection mark, begin or end
462 positions, and optionally set them to new values. 529 positions, and optionally set them to new values.
463 530
531 $term->selection_make ($eventtime[, $rectangular])
532 Tries to make a selection as set by "selection_beg" and
533 "selection_end". If $rectangular is true (default: false), a
534 rectangular selection will be made. This is the prefered function to
535 make a selection.
536
464 $success = $term->selection_grab ($eventtime) 537 $success = $term->selection_grab ($eventtime)
465 Try to request the primary selection from the server (for example, 538 Try to request the primary selection text from the server (for
466 as set by the next method). 539 example, as set by the next method). No visual feedback will be
540 given. This function is mostly useful from within "on_sel_grab"
541 hooks.
467 542
468 $oldtext = $term->selection ([$newtext]) 543 $oldtext = $term->selection ([$newtext])
469 Return the current selection text and optionally replace it by 544 Return the current selection text and optionally replace it by
470 $newtext. 545 $newtext.
471 546
516 $string = $term->locale_decode ($octets) 591 $string = $term->locale_decode ($octets)
517 Convert the given locale-encoded octets into a perl string. 592 Convert the given locale-encoded octets into a perl string.
518 593
519 $term->scr_xor_span ($beg_row, $beg_col, $end_row, $end_col[, $rstyle]) 594 $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 595 XORs the rendition values in the given span with the provided value
521 (default: "RS_RVid"). Useful in refresh hooks to provide effects 596 (default: "RS_RVid"), which *MUST NOT* contain font styles. Useful
522 similar to the selection. 597 in refresh hooks to provide effects similar to the selection.
523 598
524 $term->scr_xor_rect ($beg_row, $beg_col, $end_row, $end_col[, $rstyle1[, 599 $term->scr_xor_rect ($beg_row, $beg_col, $end_row, $end_col[, $rstyle1[,
525 $rstyle2]]) 600 $rstyle2]])
526 Similar to "scr_xor_span", but xors a rectangle instead. Trailing 601 Similar to "scr_xor_span", but xors a rectangle instead. Trailing
527 whitespace will additionally be xored with the $rstyle2, which 602 whitespace will additionally be xored with the $rstyle2, which
528 defaults to "RS_RVid | RS_Uline", which removes reverse video again 603 defaults to "RS_RVid | RS_Uline", which removes reverse video again
529 and underlines it instead. 604 and underlines it instead. Both styles *MUST NOT* contain font
605 styles.
530 606
531 $term->scr_bell 607 $term->scr_bell
532 Ring the bell! 608 Ring the bell!
533 609
534 $term->scr_add_lines ($string) 610 $term->scr_add_lines ($string)
577 $max_scrollback = $term->saveLines 653 $max_scrollback = $term->saveLines
578 $nrow_plus_saveLines = $term->total_rows 654 $nrow_plus_saveLines = $term->total_rows
579 $lines_in_scrollback = $term->nsaved 655 $lines_in_scrollback = $term->nsaved
580 Return various integers describing terminal characteristics. 656 Return various integers describing terminal characteristics.
581 657
658 $x_display = $term->display_id
659 Return the DISPLAY used by rxvt-unicode.
660
582 $lc_ctype = $term->locale 661 $lc_ctype = $term->locale
583 Returns the LC_CTYPE category string used by this rxvt-unicode. 662 Returns the LC_CTYPE category string used by this rxvt-unicode.
584 663
585 $x_display = $term->display_id 664 $env = $term->env
586 Return the DISPLAY used by rxvt-unicode. 665 Returns a copy of the environment in effect for the terminal as a
666 hashref similar to "\%ENV".
587 667
588 $modifiermask = $term->ModLevel3Mask 668 $modifiermask = $term->ModLevel3Mask
589 $modifiermask = $term->ModMetaMask 669 $modifiermask = $term->ModMetaMask
590 $modifiermask = $term->ModNumLockMask 670 $modifiermask = $term->ModNumLockMask
591 Return the modifier masks corresponding to the "ISO Level 3 Shift" 671 Return the modifier masks corresponding to the "ISO Level 3 Shift"
670 Return the row number of the first/last row of the line, 750 Return the row number of the first/last row of the line,
671 respectively. 751 respectively.
672 752
673 $offset = $line->offset_of ($row, $col) 753 $offset = $line->offset_of ($row, $col)
674 Returns the character offset of the given row|col pair within 754 Returns the character offset of the given row|col pair within
675 the logical line. 755 the logical line. Works for rows outside the line, too, and
756 returns corresponding offsets outside the string.
676 757
677 ($row, $col) = $line->coord_of ($offset) 758 ($row, $col) = $line->coord_of ($offset)
678 Translates a string offset into terminal coordinates again. 759 Translates a string offset into terminal coordinates again.
679 760
680 $text = $term->special_encode $string 761 $text = $term->special_encode $string
727 808
728 $popup->show 809 $popup->show
729 Displays the popup (which is initially hidden). 810 Displays the popup (which is initially hidden).
730 811
731 The "urxvt::timer" Class 812 The "urxvt::timer" Class
732 This class implements timer watchers/events. Time is represented as 813 This class implements timer watchers/events. Time is represented as a
733 a fractional number of seconds since the epoch. Example: 814 fractional number of seconds since the epoch. Example:
734 815
735 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0); 816 $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
736 $term->{timer} = urxvt::timer 817 $term->{timer} = urxvt::timer
737 ->new 818 ->new
738 ->interval (1) 819 ->interval (1)
739 ->cb (sub { 820 ->cb (sub {
740 $term->{overlay}->set (0, 0, 821 $term->{overlay}->set (0, 0,
741 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]); 822 sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
742 }); 823 });
743 824
744 $timer = new urxvt::timer 825 $timer = new urxvt::timer
745 Create a new timer object in started state. It is scheduled to 826 Create a new timer object in started state. It is scheduled to fire
746 fire immediately. 827 immediately.
747 828
748 $timer = $timer->cb (sub { my ($timer) = @_; ... }) 829 $timer = $timer->cb (sub { my ($timer) = @_; ... })
749 Set the callback to be called when the timer triggers. 830 Set the callback to be called when the timer triggers.
750 831
751 $tstamp = $timer->at 832 $tstamp = $timer->at
752 Return the time this watcher will fire next. 833 Return the time this watcher will fire next.
753 834
754 $timer = $timer->set ($tstamp) 835 $timer = $timer->set ($tstamp)
755 Set the time the event is generated to $tstamp. 836 Set the time the event is generated to $tstamp.
756 837
757 $timer = $timer->interval ($interval) 838 $timer = $timer->interval ($interval)
758 Normally (and when $interval is 0), the timer will automatically 839 Normally (and when $interval is 0), the timer will automatically
759 stop after it has fired once. If $interval is non-zero, then the 840 stop after it has fired once. If $interval is non-zero, then the
760 timer is automatically rescheduled at the given intervals. 841 timer is automatically rescheduled at the given intervals.
761 842
762 $timer = $timer->start 843 $timer = $timer->start
763 Start the timer. 844 Start the timer.
764 845
765 $timer = $timer->start ($tstamp) 846 $timer = $timer->start ($tstamp)
766 Set the event trigger time to $tstamp and start the timer. 847 Set the event trigger time to $tstamp and start the timer.
767 848
768 $timer = $timer->stop 849 $timer = $timer->stop
769 Stop the timer. 850 Stop the timer.
770 851
771 The "urxvt::iow" Class 852 The "urxvt::iow" Class
772 This class implements io watchers/events. Example: 853 This class implements io watchers/events. Example:
773 854
774 $term->{socket} = ... 855 $term->{socket} = ...
775 $term->{iow} = urxvt::iow 856 $term->{iow} = urxvt::iow
776 ->new 857 ->new
777 ->fd (fileno $term->{socket}) 858 ->fd (fileno $term->{socket})
778 ->events (urxvt::EVENT_READ) 859 ->events (urxvt::EVENT_READ)
779 ->start 860 ->start
780 ->cb (sub { 861 ->cb (sub {
781 my ($iow, $revents) = @_; 862 my ($iow, $revents) = @_;
782 # $revents must be 1 here, no need to check 863 # $revents must be 1 here, no need to check
783 sysread $term->{socket}, my $buf, 8192 864 sysread $term->{socket}, my $buf, 8192
784 or end-of-file; 865 or end-of-file;
785 }); 866 });
786 867
787 $iow = new urxvt::iow 868 $iow = new urxvt::iow
788 Create a new io watcher object in stopped state. 869 Create a new io watcher object in stopped state.
789 870
790 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... }) 871 $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })
791 Set the callback to be called when io events are triggered. 872 Set the callback to be called when io events are triggered.
792 $reventmask is a bitset as described in the "events" method. 873 $reventmask is a bitset as described in the "events" method.
793 874
794 $iow = $iow->fd ($fd) 875 $iow = $iow->fd ($fd)
795 Set the filedescriptor (not handle) to watch. 876 Set the filedescriptor (not handle) to watch.
796 877
797 $iow = $iow->events ($eventmask) 878 $iow = $iow->events ($eventmask)
798 Set the event mask to watch. The only allowed values are 879 Set the event mask to watch. The only allowed values are
799 "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be 880 "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be ORed
800 ORed together, or "urxvt::EVENT_NONE". 881 together, or "urxvt::EVENT_NONE".
801 882
802 $iow = $iow->start 883 $iow = $iow->start
803 Start watching for requested events on the given handle. 884 Start watching for requested events on the given handle.
804 885
805 $iow = $iow->stop 886 $iow = $iow->stop
806 Stop watching for events on the given filehandle. 887 Stop watching for events on the given filehandle.
807 888
808ENVIRONMENT 889ENVIRONMENT
809 URXVT_PERL_VERBOSITY 890 URXVT_PERL_VERBOSITY
810 This variable controls the verbosity level of the perl extension. 891 This variable controls the verbosity level of the perl extension. Higher
811 Higher numbers indicate more verbose output. 892 numbers indicate more verbose output.
812 893
813 == 0 - fatal messages 894 == 0 - fatal messages
814 >= 3 - script loading and management 895 >= 3 - script loading and management
815 >=10 - all events received 896 >=10 - all called hooks
897 >=11 - hook reutrn values
816 898
817AUTHOR 899AUTHOR
818 Marc Lehmann <pcg@goof.com> 900 Marc Lehmann <pcg@goof.com>
819 http://software.schmorp.de/pkg/rxvt-unicode 901 http://software.schmorp.de/pkg/rxvt-unicode
820 902

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines