1tecla(5) Standards, Environments, and Macros tecla(5)
2
3
4
6 tecla, teclarc - User interface provided by the tecla library.
7
9 This man page describes the command-line editing features that are
10 available to users of programs that read keyboard input via the tecla
11 library. Users of the tcsh shell will find the default key bindings
12 very familiar. Users of the bash shell will also find it quite famil‐
13 iar, but with a few minor differences, most notably in how forward and
14 backward searches through the list of historical commands are per‐
15 formed. There are two major editing modes, one with emacs-like key
16 bindings and another with vi-like key bindings. By default emacs mode
17 is enabled, but vi(1) mode can alternatively be selected via the user's
18 configuration file. This file can also be used to change the bindings
19 of individual keys to suit the user's preferences. By default, tab com‐
20 pletion is provided. If the application hasn't reconfigured this to
21 complete other types of symbols, then tab completion completes file
22 names.
23
24 Key Sequence Notation
25 In the rest of this man page, and also in all tecla configuration
26 files, key sequences are expressed as follows.
27
28 ^A or C-a This is a 'CONTROL-A', entered by pressing the CONTROL key
29 at the same time as the 'A' key.
30
31
32 \fR or M- In key sequences, both of these notations can be entered
33 either by pressing the ESCAPE key, then the following key,
34 or by pressing the META key at the same time as the fol‐
35 lowing key. Thus the key sequence M-p can be typed in two
36 ways, by pressing the ESCAPE key, followed by pressing
37 'P', or by pressing the META key at the same time as 'P'.
38
39
40 up This refers to the up-arrow key.
41
42
43 down This refers to the down-arrow key.
44
45
46 left This refers to the left-arrow key.
47
48
49 right This refers to the right-arrow key.
50
51
52 a This is just a normal 'A' key.
53
54
55 The Tecla Configuration File
56 By default, tecla looks for a file called .teclarc in your home direc‐
57 tory (ie. ~/.teclarc). If it finds this file, it reads it, interpreting
58 each line as defining a new key binding or an editing configuration
59 option. Since the emacs key-bindings are installed by default, if you
60 want to use the non-default vi editing mode, the most important item to
61 go in this file is the following line:
62
63 edit-mode vi
64
65
66
67 This will re-configure the default bindings for vi-mode. The complete
68 set of arguments that this command accepts are:
69
70 vi Install key bindings like those of the vi editor.
71
72
73 emacs Install key bindings like those of the emacs editor. This is
74 the default.
75
76
77 none Use just the native line editing facilities provided by the
78 terminal driver.
79
80
81
82 To prevent the terminal bell from being rung, such as when an unrecog‐
83 nized control-sequence is typed, place the following line in the con‐
84 figuration file:
85
86 nobeep
87
88
89
90 An example of a key binding line in the configuration file is the fol‐
91 lowing.
92
93 bind M-[2~ insert-mode
94
95
96
97 On many keyboards, the above key sequence is generated when one presses
98 the insert key, so with this key binding, one can toggle between the
99 emacs-mode insert and overwrite modes by hitting one key. One could
100 also do it by typing out the above sequence of characters one by one.
101 As explained above, the M- part of this sequence can be typed either by
102 pressing the ESCAPE key before the following key, or by pressing the
103 META key at the same time as the following key. Thus if you had set the
104 above key binding, and the insert key on your keyboard didn't generate
105 the above key sequence, you could still type it in either of the fol‐
106 lowing 2 ways.
107
108 1. Hit the ESCAPE key momentarily, then press '[', then '2',
109 then finally '~'.
110
111 2. Press the META key at the same time as pressing the '[' key,
112 then press '2', then '~'.
113
114
115 If you set a key binding for a key sequence that is already bound to a
116 function, the new binding overrides the old one. If in the new binding
117 you omit the name of the new function to bind to the key sequence, the
118 original binding becomes undefined.
119
120
121 Starting with versions of libtecla later than 1.3.3 it is now possible
122 to bind key sequences that begin with a printable character. Previously
123 key sequences were required to start with a CONTROL or META character.
124
125
126 Note that the special keywords "up", "down", "left", and "right" refer
127 to the arrow keys, and are thus not treated as key sequences. So, for
128 example, to rebind the up and down arrow keys to use the history search
129 mechanism instead of the simple history recall method, you could place
130 the following in your configuration file:
131
132 bind up history-search-backwards
133 bind down history-search-backwards
134
135
136
137 To unbind an existing binding, you can do this with the bind command by
138 omitting to name any action to rebind the key sequence to. For example,
139 by not specifying an action function, the following command unbinds the
140 default beginning-of-line action from the ^A key sequence:
141
142 bind ^A
143
144
145
146 If you create a ~/.teclarc configuration file, but it appears to have
147 no effect on the program, check the documentation of the program to see
148 if the author chose a different name for this file.
149
150 Filename and Tilde Completion
151 With the default key bindings, pressing the TAB key (aka. ^I) results
152 in tecla attempting to complete the incomplete file name that precedes
153 the cursor. Tecla searches backwards from the cursor, looking for the
154 start of the file name, stopping when it hits either a space or the
155 start of the line. If more than one file has the specified prefix, then
156 tecla completes the file name up to the point at which the ambiguous
157 matches start to differ, then lists the possible matches.
158
159
160 In addition to literally written file names, tecla can complete files
161 that start with ~/ and ~user/ expressions and that contain $envvar
162 expressions. In particular, if you hit TAB within an incomplete ~user,
163 expression, tecla will attempt to complete the username, listing any
164 ambiguous matches.
165
166
167 The completion binding is implemented using the cpl_complete_word()
168 function, which is also available separately to users of this library.
169 See the cpl_complete_word(3TECLA) man page for more details.
170
171 Filename Expansion
172 With the default key bindings, pressing ^X* causes tecla to expand the
173 file name that precedes the cursor, replacing ~/ and ~user/ expressions
174 with the corresponding home directories, and replacing $envvar expres‐
175 sions with the value of the specified environment variable, then if
176 there are any wildcards, replacing the so far expanded file name with a
177 space-separated list of the files which match the wild cards.
178
179
180 The expansion binding is implemented using the ef_expand_file() func‐
181 tion. See the ef_expand_file(3TECLA) man page for more details.
182
183 Recalling Previously Typed Lines
184 Every time that a new line is entered by the user, it is appended to a
185 list of historical input lines maintained within the GetLine resource
186 object. You can traverse up and down this list using the up and down
187 arrow keys. Alternatively, you can do the same with the ^P, and ^N
188 keys, and in vi command mode you can alternatively use the k and j
189 characters. Thus pressing up-arrow once, replaces the current input
190 line with the previously entered line. Pressing up-arrow again,
191 replaces this with the line that was entered before it, etc.. Having
192 gone back one or more lines into the history list, one can return to
193 newer lines by pressing down-arrow one or more times. If you do this
194 sufficient times, you will return to the original line that you were
195 entering when you first hit up-arrow.
196
197
198 Note that in vi mode, all of the history recall functions switch the
199 library into command mode.
200
201
202 In emacs mode the M-p and M-n keys work just like the ^P and ^N keys,
203 except that they skip all but those historical lines which share the
204 prefix that precedes the cursor. In vi command mode the upper case 'K'
205 and 'J' characters do the same thing, except that the string that they
206 search for includes the character under the cursor as well as what pre‐
207 cedes it.
208
209
210 Thus for example, suppose that you were in emacs mode, and you had just
211 entered the following list of commands in the order shown:
212
213 ls ~/tecla/
214 cd ~/tecla
215 ls -l getline.c
216 emacs ~/tecla/getline.c
217
218
219
220 If you next typed:
221
222 ls
223
224
225
226 and then hit M-p, then rather than returning the previously typed emacs
227 line, which doesn't start with "ls", tecla would recall the "ls -l get‐
228 line.c" line. Pressing M-p again would recall the "ls ~/tecla/" line.
229
230
231 Note that if the string that you are searching for, contains any of the
232 special characters, *, ?, or '[', then it is interpretted as a pattern
233 to be matched. Thus, cotinuing with the above example, after typing in
234 the list of commands shown, if you then typed:
235
236 *tecla*
237
238
239
240 and hit M-p, then the "emacs ~/tecla/getline.c" line would be recalled
241 first, since it contains the word tecla somewhere in the line, Simi‐
242 larly, hitting M-p again, would recall the "ls ~/tecla/" line, and hit‐
243 ting it once more would recall the "ls ~/tecla/" line. The pattern syn‐
244 tax is the same as that described for file name expansion, in the
245 ef_expand_file(3TECLA).
246
247 History Files
248 Authors of programs that use the tecla library have the option of sav‐
249 ing historical command-lines in a file before exiting, and subsequently
250 reading them back in from this file when the program is next started.
251 There is no standard name for this file, since it makes sense for each
252 application to use its own history file, so that commands from differ‐
253 ent applications don't get mixed up.
254
255 International Character Sets
256 Since libtecla version 1.4.0, tecla has been 8-bit clean. This means
257 that all 8-bit characters that are printable in the user's current
258 locale are now displayed verbatim and included in the returned input
259 line. Assuming that the calling program correctly contains a call like
260 the following,
261
262 setlocale(LC_CTYPE, "");
263
264
265
266 then the current locale is determined by the first of the environment
267 variables LC_CTYPE, LC_ALL, and LANG, that is found to contain a valid
268 locale name. If none of these variables are defined, or the program
269 neglects to call setlocale, then the default C locale is used, which is
270 US 7-bit ASCII. On most unix-like platforms, you can get a list of
271 valid locales by typing the command:
272
273 locale -a
274
275
276
277 at the shell prompt.
278
279 Meta Keys and Locales
280 Beware that in most locales other than the default C locale, META char‐
281 acters become printable, and they are then no longer considered to
282 match M-c style key bindings. This allows international characters to
283 be entered with the compose key without unexpectedly triggering META
284 key bindings. You can still invoke META bindings, since there are actu‐
285 ally two ways to do this. For example the binding M-c can also be
286 invoked by pressing the ESCAPE key momentarily, then pressing the c
287 key, and this will work regardless of locale. Moreover, many modern
288 terminal emulators, such as gnome's gnome-terminal's and KDE's konsole
289 terminals, already generate escape pairs like this when you use the
290 META key, rather than a real meta character, and other emulators usu‐
291 ally have a way to request this behavior, so you can continue to use
292 the META key on most systems.
293
294
295 For example, although xterm terminal emulators generate real 8-bit meta
296 characters by default when you use the META key, they can be configured
297 to output the equivalent escape pair by setting their EightBitInput X
298 resource to False. You can either do this by placing a line like the
299 following in your ~/.Xdefaults file,
300
301 XTerm*EightBitInput: False
302
303
304
305 or by starting an xterm with an -xrm '*EightBitInput: False' command-
306 line argument. In recent versions of xterm you can toggle this feature
307 on and off with the 'Meta Sends Escape' option in the menu that is dis‐
308 played when you press the left mouse button and the CONTROL key within
309 an xterm window. In CDE, dtterms can be similarly coerced to generate
310 escape pairs in place of meta characters, by setting the Dtterm*KshMode
311 resource to True.
312
313 Entering International Characters
314 If you don't have a keyboard that generates all of the international
315 characters that you need, there is usually a compose key that will
316 allow you to enter special characters, or a way to create one. For
317 example, under X windows on unix-like systems, if your keyboard doesn't
318 have a compose key, you can designate a redundant key to serve this
319 purpose with the xmodmap command. For example, on many PC keyboards
320 there is a microsoft-windows key, which is otherwise useless under
321 Linux. On a laptop, for example, the xev program might report that
322 pressing this key generates keycode 115. To turn this key into a COM‐
323 POSE key, do the following:
324
325 xmodmap -e 'keycode 115 = Multi_key'
326
327
328
329 Type this key followed by a " character to enter an 'I' with a umlaut
330 over it.
331
332 The Available Key Binding Functions
333 The following is a list of the editing functions provided by the tecla
334 library. The names in the leftmost column of the list can be used in
335 configuration files to specify which function a given key or combina‐
336 tion of keys should invoke. They are also used in the next two sections
337 to list the default key bindings in emacs and vi modes.
338
339 user-interrupt Send a SIGINT signal to the parent
340 process.
341
342
343 suspend Suspend the parent process.
344
345
346 stop-output Pause terminal output.
347
348
349 start-output Resume paused terminal output.
350
351
352 literal-next Arrange for the next character to be
353 treated as a normal character. This
354 allows control characters to be entered.
355
356
357 cursor-right Move the cursor one character right.
358
359
360 cursor-left Move the cursor one character left.
361
362
363 insert-mode Toggle between insert mode and overwrite
364 mode.
365
366
367 beginning-of-line Move the cursor to the beginning of the
368 line.
369
370
371 end-of-line Move the cursor to the end of the line.
372
373
374 delete-line Delete the contents of the current line.
375
376
377 kill-line Delete everything that follows the cur‐
378 sor.
379
380
381 backward-kill-line Delete all characters between the cursor
382 and the start of the line.
383
384
385 forward-word Move to the end of the word which follows
386 the cursor.
387
388
389 forward-to-word Move the cursor to the start of the word
390 that follows the cursor.
391
392
393 backward-word Move to the start of the word which pre‐
394 cedes the cursor.
395
396
397 goto-column Move the cursor to the 1-relative column
398 in the line specified by any preceding
399 digit-argument sequences (see Entering
400 Repeat Counts below).
401
402
403 find-parenthesis If the cursor is currently over a paren‐
404 thesis character, move it to the matching
405 parenthesis character. If not over a
406 parenthesis character move right to the
407 next close parenthesis.
408
409
410 forward-delete-char Delete the character under the cursor.
411
412
413 backward-delete-char Delete the character which precedes the
414 cursor.
415
416
417 list-or-eof This is intended for binding to ^D. When
418 invoked when the cursor is within the
419 line it displays all possible completions
420 then redisplays the line unchanged. When
421 invoked on an empty line, it signals end-
422 of-input (EOF) to the caller of
423 gl_get_line().
424
425
426 del-char-or-list-or-eof This is intended for binding to ^D. When
427 invoked when the cursor is within the
428 line it invokes forward-delete-char. When
429 invoked at the end of the line it dis‐
430 plays all possible completions then
431 redisplays the line unchanged. When
432 invoked on an empty line, it signals end-
433 of-input (EOF) to the caller of
434 gl_get_line().
435
436
437 forward-delete-word Delete the word which follows the cursor.
438
439
440 backward-delete-word Delete the word which precedes the cur‐
441 sor.
442
443
444 upcase-word Convert all of the characters of the word
445 which follows the cursor, to upper case.
446
447
448 downcase-word Convert all of the characters of the word
449 which follows the cursor, to lower case.
450
451
452 capitalize-word Capitalize the word which follows the
453 cursor.
454
455
456 change-case If the next character is upper case, tog‐
457 gle it to lower case and vice versa.
458
459
460 redisplay Redisplay the line.
461
462
463 clear-screen Clear the terminal, then redisplay the
464 current line.
465
466
467 transpose-chars Swap the character under the cursor with
468 the character just before the cursor.
469
470
471 set-mark Set a mark at the position of the cursor.
472
473
474 exchange-point-and-mark Move the cursor to the last mark that was
475 set, and move the mark to where the cur‐
476 sor used to be.
477
478
479 kill-region Delete the characters that lie between
480 the last mark that was set, and the cur‐
481 sor.
482
483
484 copy-region-as-kill Copy the text between the mark and the
485 cursor to the cut buffer, without delet‐
486 ing the original text.
487
488
489 yank Insert the text that was last deleted,
490 just before the current position of the
491 cursor.
492
493
494 append-yank Paste the current contents of the cut
495 buffer, after the cursor.
496
497
498 up-history Recall the next oldest line that was
499 entered. Note that in vi mode you are
500 left in command mode.
501
502
503 down-history Recall the next most recent line that was
504 entered. If no history recall session is
505 currently active, the next line from a
506 previous recall session is recalled. Note
507 that in vi mode you are left in command
508 mode.
509
510
511 history-search-backward Recall the next oldest line who's prefix
512 matches the string which currently pre‐
513 cedes the cursor (in vi command-mode the
514 character under the cursor is also
515 included in the search string). Note that
516 in vi mode you are left in command mode.
517
518
519 history-search-forward Recall the next newest line who's prefix
520 matches the string which currently pre‐
521 cedes the cursor (in vi command-mode the
522 character under the cursor is also
523 included in the search string). Note that
524 in vi mode you are left in command mode.
525
526
527 history-re-search-backward Recall the next oldest line who's prefix
528 matches that established by the last
529 invocation of either history-search-for‐
530 ward or history-search-backward.
531
532
533 history-re-search-forward Recall the next newest line who's prefix
534 matches that established by the last
535 invocation of either history-search-for‐
536 ward or history-search-backward.
537
538
539 complete-word Attempt to complete the incomplete word
540 which precedes the cursor. Unless the
541 host program has customized word comple‐
542 tion, file name completion is attempted.
543 In vi commmand mode the character under
544 the cursor is also included in the word
545 being completed, and you are left in vi
546 insert mode.
547
548
549 expand-filename Within the command line, expand wild
550 cards, tilde expressions and dollar
551 expressions in the file name which imme‐
552 diately precedes the cursor. In vi comm‐
553 mand mode the character under the cursor
554 is also included in the file name being
555 expanded, and you are left in vi insert
556 mode.
557
558
559 list-glob List any file names which match the wild-
560 card, tilde and dollar expressions in the
561 file name which immediately precedes the
562 cursor, then redraw the input line
563 unchanged.
564
565
566 list-history Display the contents of the history list
567 for the current history group. If a
568 repeat count of > 1 is specified, only
569 that many of the most recent lines are
570 displayed. See the Entering Repeat Counts
571 section.
572
573
574 read-from-file Temporarily switch to reading input from
575 the file who's name precedes the cursor.
576
577
578 read-init-files Re-read teclarc configuration files.
579
580
581 beginning-of-history Move to the oldest line in the history
582 list. Note that in vi mode you are left
583 in command mode.
584
585
586 end-of-history Move to the newest line in the history
587 list (ie. the current line). Note that in
588 vi mode this leaves you in command mode.
589
590
591 digit-argument Enter a repeat count for the next key
592 binding function. For details, see the
593 Entering Repeat Counts section.
594
595
596 newline Terminate and return the current contents
597 of the line, after appending a newline
598 character. The newline character is nor‐
599 mally '0, but will be the first character
600 of the key sequence that invoked the new‐
601 line action, if this happens to be a
602 printable character. If the action was
603 invoke'd cbayrritahgee 'r0etnuerwnlincehacrhaacrtaecrt,ertohre
604 the '
605 line is appended to the history buffer.
606
607
608 repeat-history Return the line that is being edited,
609 then arrange for the next most recent
610 entry in the history buffer to be
611 recalled when tecla is next called.
612 Repeatedly invoking this action causes
613 successive historical input lines to be
614 re-executed. Note that this action is
615 equivalent to the 'Operate' action in
616 ksh.
617
618
619 ring-bell Ring the terminal bell, unless the bell
620 has been silenced via the nobeep configu‐
621 ration option (see The Tecla Configura‐
622 tion File section).
623
624
625 forward-copy-char Copy the next character into the cut buf‐
626 fer (NB. use repeat counts to copy more
627 than one).
628
629
630 backward-copy-char Copy the previous character into the cut
631 buffer.
632
633
634 forward-copy-word Copy the next word into the cut buffer.
635
636
637 backward-copy-word Copy the previous word into the cut buf‐
638 fer.
639
640
641 forward-find-char Move the cursor to the next occurrence of
642 the next character that you type.
643
644
645 backward-find-char Move the cursor to the last occurrence of
646 the next character that you type.
647
648
649 forward-to-char Move the cursor to the character just
650 before the next occurrence of the next
651 character that the user types.
652
653
654 backward-to-char Move the cursor to the character just
655 after the last occurrence before the cur‐
656 sor of the next character that the user
657 types.
658
659
660 repeat-find-char Repeat the last backward-find-char, for‐
661 ward-find-char, backward-to-char or for‐
662 ward-to-char.
663
664
665 invert-refind-char Repeat the last backward-find-char, for‐
666 ward-find-char, backward-to-char, or for‐
667 ward-to-char in the opposite direction.
668
669
670 delete-to-column Delete the characters from the cursor up
671 to the column that is specified by the
672 repeat count.
673
674
675 delete-to-parenthesis Delete the characters from the cursor up
676 to and including the matching parenthe‐
677 sis, or next close parenthesis.
678
679
680 forward-delete-find Delete the characters from the cursor up
681 to and including the following occurence
682 of the next character typed.
683
684
685 backward-delete-find Delete the characters from the cursor up
686 to and including the preceding occurence
687 of the next character typed.
688
689
690 forward-delete-to Delete the characters from the cursor up
691 to, but not including, the following
692 occurence of the next character typed.
693
694
695 backward-delete-to Delete the characters from the cursor up
696 to, but not including, the preceding
697 occurence of the next character typed.
698
699
700 delete-refind Repeat the last *-delete-find or
701 *-delete-to action.
702
703
704 delete-invert-refind Repeat the last *-delete-find or
705 *-delete-to action, in the opposite
706 direction.
707
708
709 copy-to-column Copy the characters from the cursor up to
710 the column that is specified by the
711 repeat count, into the cut buffer.
712
713
714 copy-to-parenthesis Copy the characters from the cursor up to
715 and including the matching parenthesis,
716 or next close parenthesis, into the cut
717 buffer.
718
719
720 forward-copy-find Copy the characters from the cursor up to
721 and including the following occurence of
722 the next character typed, into the cut
723 buffer.
724
725
726 backward-copy-find Copy the characters from the cursor up to
727 and including the preceding occurence of
728 the next character typed, into the cut
729 buffer.
730
731
732 forward-copy-to Copy the characters from the cursor up
733 to, but not including, the following
734 occurence of the next character typed,
735 into the cut buffer.
736
737
738 backward-copy-to Copy the characters from the cursor up
739 to, but not including, the preceding
740 occurence of the next character typed,
741 into the cut buffer.
742
743
744 copy-refind Repeat the last *-copy-find or *-copy-to
745 action.
746
747
748 copy-invert-refind Repeat the last *-copy-find or *-copy-to
749 action, in the opposite direction.
750
751
752 vi-mode Switch to vi mode from emacs mode.
753
754
755 emacs-mode Switch to emacs mode from vi mode.
756
757
758 vi-insert From vi command mode, switch to insert
759 mode.
760
761
762 vi-overwrite From vi command mode, switch to overwrite
763 mode.
764
765
766 vi-insert-at-bol From vi command mode, move the cursor to
767 the start of the line and switch to
768 insert mode.
769
770
771 vi-append-at-eol From vi command mode, move the cursor to
772 the end of the line and switch to append
773 mode.
774
775
776 vi-append From vi command mode, move the cursor one
777 position right, and switch to insert
778 mode.
779
780
781 vi-replace-char From vi command mode, replace the charac‐
782 ter under the cursor with the next char‐
783 acter entered.
784
785
786 vi-forward-change-char From vi command mode, delete the next
787 character then enter insert mode.
788
789
790 vi-backward-change-char From vi command mode, delete the preced‐
791 ing character then enter insert mode.
792
793
794 vi-forward-change-word From vi command mode, delete the next
795 word then enter insert mode.
796
797
798 vi-backward-change-word From vi command mode, delete the preced‐
799 ing word then enter insert mode.
800
801
802 vi-change-rest-of-line From vi command mode, delete from the
803 cursor to the end of the line, then enter
804 insert mode.
805
806
807 vi-change-line From vi command mode, delete the current
808 line, then enter insert mode.
809
810
811 vi-change-to-bol From vi command mode, delete all charac‐
812 ters between the cursor and the beginning
813 of the line, then enter insert mode.
814
815
816 vi-change-to-column From vi command mode, delete the charac‐
817 ters from the cursor up to the column
818 that is specified by the repeat count,
819 then enter insert mode.
820
821
822 vi-change-to-parenthesis Delete the characters from the cursor up
823 to and including the matching parenthe‐
824 sis, or next close parenthesis, then
825 enter vi insert mode.
826
827
828 vi-forward-change-find From vi command mode, delete the charac‐
829 ters from the cursor up to and including
830 the following occurence of the next char‐
831 acter typed, then enter insert mode.
832
833
834 vi-backward-change-find From vi command mode, delete the charac‐
835 ters from the cursor up to and including
836 the preceding occurence of the next char‐
837 acter typed, then enter insert mode.
838
839
840 vi-forward-change-to From vi command mode, delete the charac‐
841 ters from the cursor up to, but not
842 including, the following occurence of the
843 next character typed, then enter insert
844 mode.
845
846
847 vi-backward-change-to From vi command mode, delete the charac‐
848 ters from the cursor up to, but not
849 including, the preceding occurence of the
850 next character typed, then enter insert
851 mode.
852
853
854 vi-change-refind Repeat the last vi-*-change-find or
855 vi-*-change-to action.
856
857
858 vi-change-invert-refind Repeat the last vi-*-change-find or
859 vi-*-change-to action, in the opposite
860 direction.
861
862
863 vi-undo In vi mode, undo the last editing opera‐
864 tion.
865
866
867 vi-repeat-change In vi command mode, repeat the last com‐
868 mand that modified the line.
869
870
871 Default Key Bindings In emacs Mode
872 The following default key bindings, which can be overriden by the tecla
873 configuration file, are designed to mimic most of the bindings of the
874 unix tcsh shell shell, when it is in emacs editing mode.
875
876
877 This is the default editing mode of the tecla library.
878
879
880 Under UNIX the terminal driver sets a number of special keys for cer‐
881 tain functions. The tecla library attempts to use the same key bindings
882 to maintain consistency. The key sequences shown for the following 6
883 bindings are thus just examples of what they will probably be set to.
884 If you have used the stty command to change these keys, then the
885 default bindings should match.
886
887 ^C user-interrupt
888
889
890 ^\fR abort
891
892
893 ^Z suspend
894
895
896 ^Q start-output
897
898
899 ^S stop-output
900
901
902 ^V literal-next
903
904
905
906 The cursor keys are refered to by name, as follows. This is necessary
907 because different types of terminals generate different key sequences
908 when their cursor keys are pressed.
909
910 right cursor-right
911
912
913 left cursor-left
914
915
916 up up-history
917
918
919 down down-history
920
921
922
923 The remaining bindings don't depend on the terminal setttings.
924
925 ^F cursor-right
926
927
928 ^B cursor-left
929
930
931 M-i insert-mode
932
933
934 ^A beginning-of-line
935
936
937 ^E end-of-line
938
939
940 ^U delete-line
941
942
943 ^K kill-line
944
945
946 M-f forward-word
947
948
949 M-b backward-word
950
951
952 ^D del-char-or-list-or-eof
953
954
955 ^H backward-delete-char
956
957
958 ^? backward-delete-char
959
960
961 M-d forward-delete-word
962
963
964 M-^H backward-delete-word
965
966
967 M-^? backward-delete-word
968
969
970 M-u upcase-word
971
972
973 M-l downcase-word
974
975
976 M-c capitalize-word
977
978
979 ^R redisplay
980
981
982 ^L clear-screen
983
984
985 ^T transpose-chars
986
987
988 ^@ set-mark
989
990
991 ^X^X exchange-point-and-mark
992
993
994 ^W kill-region
995
996
997 M-w copy-region-as-kill
998
999
1000 ^Y yank
1001
1002
1003 ^P up-history
1004
1005
1006 ^N down-history
1007
1008
1009 M-p history-search-backward
1010
1011
1012 M-n history-search-forward
1013
1014
1015 ^I complete-word
1016
1017
1018 ^X* expand-filename
1019
1020
1021 ^X^F read-from-file
1022
1023
1024 ^X^R read-init-files
1025
1026
1027 ^Xg list-glob
1028
1029
1030 ^Xh list-history
1031
1032
1033 M-< beginning-of-history
1034
1035
1036 M-> end-of-history
1037
1038
1039 0fR newline
1040
1041
1042 newline
1043
1044
1045 M-o repeat-history
1046
1047
1048 M-^V vi-mode
1049
1050
1051 M-0, M-1, ... M-9 digit-argument (see below)
1052
1053
1054
1055 Note that ^I is what the TAB key generates, and that ^@ can be gener‐
1056 ated not only by pressing the CONTROL key and the @ key simultaneously,
1057 but also by pressing the CONTROL key and the space bar at the same
1058 time.
1059
1060 Default Key Bindings in vi Mode
1061 The following default key bindings are designed to mimic the vi style
1062 of editing as closely as possible. This means that very few editing
1063 functions are provided in the initial character input mode, editing
1064 functions instead being provided by the vi command mode. The vi command
1065 mode is entered whenever the ESCAPE character is pressed, or whenever a
1066 key sequence that starts with a meta character is entered. In addition
1067 to mimicing vi, libtecla provides bindings for tab completion, wild-
1068 card expansion of file names, and historical line recall.
1069
1070
1071 To learn how to tell the tecla library to use vi mode instead of the
1072 default emacs editing mode, see the earlier section entitled The Tecla
1073 Configuration File.
1074
1075
1076 Under UNIX the terminal driver sets a number of special keys for cer‐
1077 tain functions. The tecla library attempts to use the same key bindings
1078 to maintain consistency, binding them both in input mode and in command
1079 mode. The key sequences shown for the following 6 bindings are thus
1080 just examples of what they will probably be set to. If you have used
1081 the stty command to change these keys, then the default bindings should
1082 match.
1083
1084 ^C user-interrupt
1085
1086
1087 ^\fR abort
1088
1089
1090 ^Z suspend
1091
1092
1093 ^Q start-output
1094
1095
1096 ^S stop-output
1097
1098
1099 ^V literal-next
1100
1101
1102 M-^C user-interrupt
1103
1104
1105 M-^\fR abort
1106
1107
1108 M-^Z suspend
1109
1110
1111 M-^Q start-output
1112
1113
1114 M-^S stop-output
1115
1116
1117
1118 Note that above, most of the bindings are defined twice, once as a raw
1119 control code like ^C and then a second time as a META character like
1120 M-^C. The former is the binding for vi input mode, whereas the latter
1121 is the binding for vi command mode. Once in command mode all key
1122 sequences that the user types that they don't explicitly start with an
1123 ESCAPE or a META key, have their first key secretly converted to a META
1124 character before the key sequence is looked up in the key binding ta‐
1125 ble. Thus, once in command mode, when you type the letter i, for exam‐
1126 ple, the tecla library actually looks up the binding for M-i.
1127
1128
1129 The cursor keys are refered to by name, as follows. This is necessary
1130 because different types of terminals generate different key sequences
1131 when their cursor keys are pressed.
1132
1133 right cursor-right
1134
1135
1136 left cursor-left
1137
1138
1139 up up-history
1140
1141
1142 down down-history
1143
1144
1145
1146 The cursor keys normally generate a key sequence that start with an
1147 ESCAPE character, so beware that using the arrow keys will put you into
1148 command mode (if you aren't already in command mode).
1149
1150
1151 The following are the terminal-independent key bindings for vi input
1152 mode.
1153
1154 ^D list-or-eof
1155
1156
1157 ^G list-glob
1158
1159
1160 ^H backward-delete-char
1161
1162
1163 ^I complete-word
1164
1165
1166 newline
1167
1168
1169 0fR newline
1170
1171
1172 ^L clear-screen
1173
1174
1175 ^N down-history
1176
1177
1178 ^P up-history
1179
1180
1181 ^R redisplay
1182
1183
1184 ^U backward-kill-line
1185
1186
1187 ^W backward-delete-word
1188
1189
1190 ^X* expand-filename
1191
1192
1193 ^X^F read-from-file
1194
1195
1196 ^X^R read-init-files
1197
1198
1199 ^? backward-delete-char
1200
1201
1202
1203 The following are the key bindings that are defined in vi command mode,
1204 this being specified by them all starting with a META character. As
1205 mentioned above, once in command mode the initial meta character is
1206 optional. For example, you might enter command mode by typing ESCAPE,
1207 and then press 'H' twice to move the cursor two positions to the left.
1208 Both 'H' characters get quietly converted to M-h before being compared
1209 to the key binding table, the first one because ESCAPE followed by a
1210 character is always converted to the equivalent META character, and the
1211 second because command mode was already active.
1212
1213 M-\fR cursor-right (META-space)
1214
1215
1216 M-$ end-of-line
1217
1218
1219 M-* expand-filename
1220
1221
1222 M-+ down-history
1223
1224
1225 M-- up-history
1226
1227
1228 M-< beginning-of-history
1229
1230
1231 M-> end-of-history
1232
1233
1234 M-^ beginning-of-line
1235
1236
1237 M- repeat-find-char
1238
1239
1240 M-, invert-refind-char
1241
1242
1243 M-| goto-column
1244
1245
1246 M-~ change-case
1247
1248
1249 M-. vi-repeat-change
1250
1251
1252 M-% find-parenthesis
1253
1254
1255 M-a vi-append
1256
1257
1258 M-A vi-append-at-eol
1259
1260
1261 M-b backward-word
1262
1263
1264 M-B backward-word
1265
1266
1267 M-C vi-change-rest-of-line
1268
1269
1270 M-cb vi-backward-change-word
1271
1272
1273 M-cB vi-backward-change-word
1274
1275
1276 M-cc vi-change-line
1277
1278
1279 M-ce vi-forward-change-word
1280
1281
1282 M-cE vi-forward-change-word
1283
1284
1285 M-cw vi-forward-change-word
1286
1287
1288 M-cW vi-forward-change-word
1289
1290
1291 M-cF vi-backward-change-find
1292
1293
1294 M-cf vi-forward-change-find
1295
1296
1297 M-cT vi-backward-change-to
1298
1299
1300 M-ct vi-forward-change-to
1301
1302
1303 M-c; vi-change-refind
1304
1305
1306 M-c, vi-change-invert-refind
1307
1308
1309 M-ch vi-backward-change-char
1310
1311
1312 M-c^H vi-backward-change-char
1313
1314
1315 M-c^? vi-backward-change-char
1316
1317
1318 M-cl vi-forward-change-char
1319
1320
1321 M-c\fR vi-forward-change-char (META-c-space)
1322
1323
1324 M-c^ vi-change-to-bol
1325
1326
1327 M-c0 vi-change-to-bol
1328
1329
1330 M-c$ vi-change-rest-of-line
1331
1332
1333 M-c| vi-change-to-column
1334
1335
1336 M-c% vi-change-to-parenthesis
1337
1338
1339 M-dh backward-delete-char
1340
1341
1342 M-d^H backward-delete-char
1343
1344
1345 M-d^? backward-delete-char
1346
1347
1348 M-dl forward-delete-char
1349
1350
1351 M-d forward-delete-char (META-d-space)
1352
1353
1354 M-dd delete-line
1355
1356
1357 M-db backward-delete-word
1358
1359
1360 M-dB backward-delete-word
1361
1362
1363 M-de forward-delete-word
1364
1365
1366 M-dE forward-delete-word
1367
1368
1369 M-dw forward-delete-word
1370
1371
1372 M-dW forward-delete-word
1373
1374
1375 M-dF backward-delete-find
1376
1377
1378 M-df forward-delete-find
1379
1380
1381 M-dT backward-delete-to
1382
1383
1384 M-dt forward-delete-to
1385
1386
1387 M-d; delete-refind
1388
1389
1390 M-d, delete-invert-refind
1391
1392
1393 M-d^ backward-kill-line
1394
1395
1396 M-d0 backward-kill-line
1397
1398
1399 M-d$ kill-line
1400
1401
1402 M-D kill-line
1403
1404
1405 M-d| delete-to-column
1406
1407
1408 M-d% delete-to-parenthesis
1409
1410
1411 M-e forward-word
1412
1413
1414 M-E forward-word
1415
1416
1417 M-f forward-find-char
1418
1419
1420 M-F backward-find-char
1421
1422
1423 M-- up-history
1424
1425
1426 M-h cursor-left
1427
1428
1429 M-H beginning-of-history
1430
1431
1432 M-i vi-insert
1433
1434
1435 M-I vi-insert-at-bol
1436
1437
1438 M-j down-history
1439
1440
1441 M-J history-search-forward
1442
1443
1444 M-k up-history
1445
1446
1447 M-K history-search-backward
1448
1449
1450 M-l cursor-right
1451
1452
1453 M-L end-of-history
1454
1455
1456 M-n history-re-search-forward
1457
1458
1459 M-N history-re-search-backward
1460
1461
1462 M-p append-yank
1463
1464
1465 M-P yank
1466
1467
1468 M-r vi-replace-char
1469
1470
1471 M-R vi-overwrite
1472
1473
1474 M-s vi-forward-change-char
1475
1476
1477 M-S vi-change-line
1478
1479
1480 M-t forward-to-char
1481
1482
1483 M-T backward-to-char
1484
1485
1486 M-u vi-undo
1487
1488
1489 M-w forward-to-word
1490
1491
1492 M-W forward-to-word
1493
1494
1495 M-x forward-delete-char
1496
1497
1498 M-X backward-delete-char
1499
1500
1501 M-yh backward-copy-char
1502
1503
1504 M-y^H backward-copy-char
1505
1506
1507 M-y^? backward-copy-char
1508
1509
1510 M-yl forward-copy-char
1511
1512
1513 M-y\fR forward-copy-char (META-y-space)
1514
1515
1516 M-ye forward-copy-word
1517
1518
1519 M-yE forward-copy-word
1520
1521
1522 M-yw forward-copy-word
1523
1524
1525 M-yW forward-copy-word
1526
1527
1528 M-yb backward-copy-word
1529
1530
1531 M-yB backward-copy-word
1532
1533
1534 M-yf forward-copy-find
1535
1536
1537 M-yF backward-copy-find
1538
1539
1540 M-yt forward-copy-to
1541
1542
1543 M-yT backward-copy-to
1544
1545
1546 M-y; copy-refind
1547
1548
1549 M-y, copy-invert-refind
1550
1551
1552 M-y^ copy-to-bol
1553
1554
1555 M-y0 copy-to-bol
1556
1557
1558 M-y$ copy-rest-of-line
1559
1560
1561 M-yy copy-line
1562
1563
1564 M-Y copy-line
1565
1566
1567 M-y| copy-to-column
1568
1569
1570 M-y% copy-to-parenthesis
1571
1572
1573 M-^E emacs-mode
1574
1575
1576 M-^H cursor-left
1577
1578
1579 M-^? cursor-left
1580
1581
1582 M-^L clear-screen
1583
1584
1585 M-^N down-history
1586
1587
1588 M-^P up-history
1589
1590
1591 M-^R redisplay
1592
1593
1594 M-^D list-or-eof
1595
1596
1597 M-^I complete-word
1598
1599
1600 M- newline
1601
1602
1603 M-0fR newline
1604
1605
1606 M-^X^R read-init-files
1607
1608
1609 M-^Xh list-history
1610
1611
1612 M-0, M-1, ... M-9 digit-argument (see below)
1613
1614
1615
1616 Note that ^I is what the TAB key generates.
1617
1618 Entering Repeat Counts
1619 Many of the key binding functions described previously, take an
1620 optional count, typed in before the target key sequence. This is inter‐
1621 preted as a repeat count by most bindings. A notable exception is the
1622 goto-column binding, which interprets the count as a column number.
1623
1624
1625 By default you can specify this count argument by pressing the META key
1626 while typing in the numeric count. This relies on the digit-argument
1627 action being bound to 'META-0', 'META-1' etc. Once any one of these
1628 bindings has been activated, you can optionally take your finger off
1629 the META key to type in the rest of the number, since every numeric
1630 digit thereafter is treated as part of the number, unless it is pre‐
1631 ceded by the literal-next binding. As soon as a non-digit, or literal
1632 digit key is pressed the repeat count is terminated and either causes
1633 the just typed character to be added to the line that many times, or
1634 causes the next key binding function to be given that argument.
1635
1636
1637 For example, in emacs mode, typing:
1638
1639 M-12a
1640
1641
1642
1643 causes the letter 'a' to be added to the line 12 times, whereas
1644
1645 M-4M-c
1646
1647
1648
1649 Capitalizes the next 4 words.
1650
1651
1652 In vi command mode the meta modifier is automatically added to all
1653 characters typed in, so to enter a count in vi command-mode, just
1654 involves typing in the number, just as it does in the vi editor itself.
1655 So for example, in vi command mode, typing:
1656
1657 4w2x
1658
1659
1660
1661 moves the cursor four words to the right, then deletes two characters.
1662
1663
1664 You can also bind digit-argument to other key sequences. If these end
1665 in a numeric digit, that digit gets appended to the current repeat
1666 count. If it doesn't end in a numeric digit, a new repeat count is
1667 started with a value of zero, and can be completed by typing in the
1668 number, after letting go of the key which triggered the digit-argument
1669 action.
1670
1672 /usr/lib/libtecla.so The tecla library
1673
1674
1675 /usr/include/libtecla.h The tecla header file
1676
1677
1678 ~/.teclarc The personal tecla customization file
1679
1680
1682 See attributes(5) for descriptions of the following attributes:
1683
1684
1685
1686
1687 ┌─────────────────────────────┬─────────────────────────────┐
1688 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
1689 ├─────────────────────────────┼─────────────────────────────┤
1690 │Availability │SUNWtecla │
1691 ├─────────────────────────────┼─────────────────────────────┤
1692 │Interface Stability │Evolving │
1693 └─────────────────────────────┴─────────────────────────────┘
1694
1696 vi(1), cpl_complete_word(3TECLA), ef_expand_file(3TECLA),
1697 gl_get_line(3TECLA), gl_io_mode(3TECLA), libtecla(3LIB),
1698 pca_lookup_file(3TECLA), attributes(5)
1699
1700
1701
1702SunOS 5.11 20 May 2004 tecla(5)