1.\" $MirOS: src/lib/libedit/editrc.5,v 1.3 2005/04/19 15:16:13 tg Exp $ 2.\" $OpenBSD: editrc.5,v 1.19 2003/11/25 20:12:38 otto Exp $ 3.\" $NetBSD: editrc.5,v 1.19 2003/11/01 23:35:33 christos Exp $ 4.\" 5.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc. 6.\" All rights reserved. 7.\" 8.\" This file was contributed to The NetBSD Foundation by Luke Mewburn. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. All advertising materials mentioning features or use of this software 19.\" must display the following acknowledgement: 20.\" This product includes software developed by the NetBSD 21.\" Foundation, Inc. and its contributors. 22.\" 4. Neither the name of The NetBSD Foundation nor the names of its 23.\" contributors may be used to endorse or promote products derived 24.\" from this software without specific prior written permission. 25.\" 26.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36.\" POSSIBILITY OF SUCH DAMAGE. 37.\" 38.Dd October 18, 2003 39.Os 40.Dt EDITRC 5 41.Sh NAME 42.Nm editrc 43.Nd configuration file for editline library 44.Sh SYNOPSIS 45.Nm 46.Sh DESCRIPTION 47The 48.Nm 49file defines various settings to be used by the 50.Xr editline 3 51library. 52.Pp 53The format of each line is: 54.Pp 55.Dl [prog:]command [arg [...]] 56.Pp 57.Ar command 58is one of the 59.Xr editline 3 60builtin commands. 61Refer to 62.Sx BUILTIN COMMANDS 63for more information. 64.Pp 65.Ar prog 66is the program name string that a program defines when it calls 67.Xr el_init 3 68to set up 69.Xr editline 3 , 70which is usually 71.Va argv[0] . 72.Ar command 73will be executed for any program which matches 74.Ar prog . 75.Pp 76.Ar prog 77may also be a 78.Xr regex 3 79style 80regular expression, in which case 81.Ar command 82will be executed for any program that matches the regular expression. 83.Pp 84If 85.Ar prog 86is absent, 87.Ar command 88is executed for all programs. 89.Sh BUILTIN COMMANDS 90The 91.Nm editline 92library has some builtin commands, which affect the way 93that the line editing and history functions operate. 94These are based on similar named builtins present in the 95.Xr tcsh 1 96shell. 97.Pp 98The following builtin commands are available: 99.Bl -tag -width 4n 100.It Ic bind Xo 101.Op Fl aeklrsv 102.Op Ar key Op Ar command 103.Xc 104Without options, list all bound keys, and the editor command to which 105each is bound. 106If 107.Ar key 108is supplied, show the bindings for 109.Ar key . 110If 111.Ar key command 112is supplied, bind 113.Ar command 114to 115.Ar key . 116Options include: 117.Bl -tag -width 4n 118.It Fl a 119List or change key bindings in the 120.Xr vi 1 121mode alternate (command mode) key map. 122.It Fl e 123Bind all keys to the standard GNU Emacs-like bindings. 124.It Fl k 125.Ar key 126is interpreted as a symbolic arrow key name, which may be one of 127.Sq up , 128.Sq down , 129.Sq left 130or 131.Sq right . 132.It Fl l 133List all editor commands and a short description of each. 134.It Fl r 135Remove a key's binding. 136.It Fl s 137.Ar command 138is taken as a literal string and treated as terminal input when 139.Ar key 140is typed. 141Bound keys in 142.Ar command 143are themselves reinterpreted, and this continues for ten levels of 144interpretation. 145.It Fl v 146Bind all keys to the standard 147.Xr vi 1 Ns -like 148bindings. 149.El 150.Pp 151.Ar command 152may be one of the commands documented in 153.Sx "EDITOR COMMANDS" 154below, or another key. 155.Pp 156.Ar key 157and 158.Ar command 159can contain control characters of the form 160.Sm off 161.Sq No ^ Ar character 162.Sm on 163.Po 164e.g.\& 165.Sq ^A 166.Pc , 167and the following backslashed escape sequences: 168.Pp 169.Bl -tag -compact -offset indent -width 4n 170.It Ic \ea 171Bell 172.It Ic \eb 173Backspace 174.It Ic \ee 175Escape 176.It Ic \ef 177Formfeed 178.It Ic \en 179Newline 180.It Ic \er 181Carriage return 182.It Ic \et 183Horizontal tab 184.It Ic \ev 185Vertical tab 186.Sm off 187.It Sy \e Ar nnn 188.Sm on 189The ASCII character corresponding to the octal number 190.Ar nnn . 191.El 192.Pp 193.Sq \e 194nullifies the special meaning of the following character, 195if it has any, notably 196.Sq \e 197and 198.Sq ^ . 199.It Ic echotc Xo 200.Op Fl sv 201.Ar arg 202.Ar ... 203.Xc 204Exercise terminal capabilities given in 205.Ar arg Ar ... . 206If 207.Ar arg 208is 209.Sq baud , 210.Sq cols , 211.Sq lines , 212.Sq rows , 213.Sq meta 214or 215.Sq tabs , 216the value of that capability is printed, with 217.Dq yes 218or 219.Dq no 220indicating that the terminal does or does not have that capability. 221.Pp 222.Fl s 223returns an empty string for non-existent capabilities, rather than 224causing an error. 225.Fl v 226causes messages to be verbose. 227.It Ic edit Op Li on | Li off 228Enable or disable the 229.Nm editline 230functionality in a program. 231.It Ic history Ar list | Ar size Dv n | Ar unique Dv n 232The 233.Ar list 234command lists all entries in the history. 235The 236.Ar size 237command sets the history size to 238.Dv n 239entries. 240The 241.Ar unique 242command controls if history should keep duplicate entries. 243If 244.Dv n 245is non zero, only keep unique history entries. 246If 247.Dv n 248is zero, then keep all entries (the default). 249.It Ic telltc 250List the values of all the terminal capabilities (see 251.Xr termcap 5 ) . 252.It Ic settc Ar cap Ar val 253Set the terminal capability 254.Ar cap 255to 256.Ar val , 257as defined in 258.Xr termcap 5 . 259No sanity checking is done. 260.It Ic setty Xo 261.Op Fl adqx 262.Op Ar +mode 263.Op Ar -mode 264.Op Ar mode 265.Op Ar char=c 266.Xc 267Control which tty modes that 268.Nm 269won't allow the user to change. 270.Fl d , 271.Fl q 272or 273.Fl x 274tells 275.Ic setty 276to act on the 277.Sq edit , 278.Sq quote 279or 280.Sq execute 281set of tty modes respectively; defaulting to 282.Fl x . 283.Pp 284Without other arguments, 285.Ic setty 286lists the modes in the chosen set which are fixed on 287.Po 288.Sq +mode 289.Pc 290or off 291.Po 292.Sq -mode 293.Pc . 294.Fl a 295lists all tty modes in the chosen set regardless of the setting. 296With 297.Ar +mode , 298.Ar -mode 299or 300.Ar mode , 301fixes 302.Ar mode 303on or off or removes control of 304.Ar mode 305in the chosen set. 306.Pp 307.Ic Setty 308can also be used to set tty characters to particular values using 309.Ar char=value . 310If 311.Ar value 312is empty 313then the character is set to 314.Dv _POSIX_VDISABLE . 315.It Ic telltc 316List the values of all the terminal capabilities (see 317.Xr termcap 5 ) . 318.El 319.Sh EDITOR COMMANDS 320The following editor commands are available for use in key bindings: 321.\" Section automatically generated with makelist 322.Bl -tag -width 4n 323.It Ic vi-paste-next 324Vi paste previous deletion to the right of the cursor. 325.It Ic vi-paste-prev 326Vi paste previous deletion to the left of the cursor. 327.It Ic vi-prev-big-word 328Vi move to the previous space delimited word. 329.It Ic vi-prev-word 330Vi move to the previous word. 331.It Ic vi-next-big-word 332Vi move to the next space delimited word. 333.It Ic vi-next-word 334Vi move to the next word. 335.It Ic vi-change-case 336Vi change case of character under the cursor and advance one character. 337.It Ic vi-change-meta 338Vi change prefix command. 339.It Ic vi-insert-at-bol 340Vi enter insert mode at the beginning of line. 341.It Ic vi-replace-char 342Vi replace character under the cursor with the next character typed. 343.It Ic vi-replace-mode 344Vi enter replace mode. 345.It Ic vi-substitute-char 346Vi replace character under the cursor and enter insert mode. 347.It Ic vi-substitute-line 348Vi substitute entire line. 349.It Ic vi-change-to-eol 350Vi change to end of line. 351.It Ic vi-insert 352Vi enter insert mode. 353.It Ic vi-add 354Vi enter insert mode after the cursor. 355.It Ic vi-add-at-eol 356Vi enter insert mode at end of line. 357.It Ic vi-delete-meta 358Vi delete prefix command. 359.It Ic vi-end-big-word 360Vi move to the end of the current space delimited word. 361.It Ic vi-end-word 362Vi move to the end of the current word. 363.It Ic vi-undo 364Vi undo last change. 365.It Ic vi-command-mode 366Vi enter command mode (use alternative key bindings). 367.It Ic vi-zero 368Vi move to the beginning of line. 369.It Ic vi-delete-prev-char 370Vi move to previous character (backspace). 371.It Ic vi-list-or-eof 372Vi list choices for completion or indicate end of file if empty line. 373.It Ic vi-kill-line-prev 374Vi cut from beginning of line to cursor. 375.It Ic vi-search-prev 376Vi search history previous. 377.It Ic vi-search-next 378Vi search history next. 379.It Ic vi-repeat-search-next 380Vi repeat current search in the same search direction. 381.It Ic vi-repeat-search-prev 382Vi repeat current search in the opposite search direction. 383.It Ic vi-next-char 384Vi move to the character specified next. 385.It Ic vi-prev-char 386Vi move to the character specified previous. 387.It Ic vi-to-next-char 388Vi move up to the character specified next. 389.It Ic vi-to-prev-char 390Vi move up to the character specified previous. 391.It Ic vi-repeat-next-char 392Vi repeat current character search in the same search direction. 393.It Ic vi-repeat-prev-char 394Vi repeat current character search in the opposite search direction. 395.It Ic vi-match 396Vi go to matching () {} or []. 397.It Ic vi-undo-line 398Vi undo all changes to line. 399.It Ic vi-to-column 400Vi go to specified column. 401.It Ic vi-yank-end 402Vi yank to end of line. 403.It Ic vi-yank 404Vi yank. 405.It Ic vi-comment-out 406Vi comment out current command. 407.It Ic vi-alias 408Vi include shell alias. 409.It Ic vi-to-history-line 410Vi go to specified history file line.. 411.It Ic vi-histedit 412Vi edit history line with vi. 413.It Ic vi-history-word 414Vi append word from previous input line. 415.It Ic vi-redo 416Vi redo last non-motion command. 417.It Ic em-delete-or-list 418Delete character under cursor or list completions if at end of line. 419.It Ic em-delete-next-word 420Cut from cursor to end of current word. 421.It Ic em-yank 422Paste cut buffer at cursor position. 423.It Ic em-kill-line 424Cut the entire line and save in cut buffer. 425.It Ic em-kill-region 426Cut area between mark and cursor and save in cut buffer. 427.It Ic em-copy-region 428Copy area between mark and cursor to cut buffer. 429.It Ic em-gosmacs-transpose 430Exchange the two characters before the cursor. 431.It Ic em-next-word 432Move next to end of current word. 433.It Ic em-upper-case 434Uppercase the characters from cursor to end of current word. 435.It Ic em-capitol-case 436Capitalize the characters from cursor to end of current word. 437.It Ic em-lower-case 438Lowercase the characters from cursor to end of current word. 439.It Ic em-set-mark 440Set the mark at cursor. 441.It Ic em-exchange-mark 442Exchange the cursor and mark. 443.It Ic em-universal-argument 444Universal argument (argument times 4). 445.It Ic em-meta-next 446Add 8th bit to next character typed. 447.It Ic em-toggle-overwrite 448Switch from insert to overwrite mode or vice versa. 449.It Ic em-copy-prev-word 450Copy current word to cursor. 451.It Ic em-inc-search-next 452Emacs incremental next search. 453.It Ic em-inc-search-prev 454Emacs incremental reverse search. 455.It Ic ed-end-of-file 456Indicate end of file. 457.It Ic ed-insert 458Add character to the line. 459.It Ic ed-delete-prev-word 460Delete from beginning of current word to cursor. 461.It Ic ed-delete-next-char 462Delete character under cursor. 463.It Ic ed-kill-line 464Cut to the end of line. 465.It Ic ed-move-to-end 466Move cursor to the end of line. 467.It Ic ed-move-to-beg 468Move cursor to the beginning of line. 469.It Ic ed-transpose-chars 470Exchange the character to the left of the cursor with the one under it. 471.It Ic ed-next-char 472Move to the right one character. 473.It Ic ed-prev-word 474Move to the beginning of the current word. 475.It Ic ed-prev-char 476Move to the left one character. 477.It Ic ed-quoted-insert 478Add the next character typed verbatim. 479.It Ic ed-digit 480Adds to argument or enters a digit. 481.It Ic ed-argument-digit 482Digit that starts argument. 483.It Ic ed-unassigned 484Indicates unbound character. 485.It Ic ed-tty-sigint 486Tty interrupt character. 487.It Ic ed-tty-dsusp 488Tty delayed suspend character. 489.It Ic ed-tty-flush-output 490Tty flush output characters. 491.It Ic ed-tty-sigquit 492Tty quit character. 493.It Ic ed-tty-sigtstp 494Tty suspend character. 495.It Ic ed-tty-stop-output 496Tty disallow output characters. 497.It Ic ed-tty-start-output 498Tty allow output characters. 499.It Ic ed-newline 500Execute command. 501.It Ic ed-delete-prev-char 502Delete the character to the left of the cursor. 503.It Ic ed-clear-screen 504Clear screen leaving current line at the top. 505.It Ic ed-redisplay 506Redisplay everything. 507.It Ic ed-start-over 508Erase current line and start from scratch. 509.It Ic ed-sequence-lead-in 510First character in a bound sequence. 511.It Ic ed-prev-history 512Move to the previous history line. 513.It Ic ed-next-history 514Move to the next history line. 515.It Ic ed-search-prev-history 516Search previous in history for a line matching the current. 517.It Ic ed-search-next-history 518Search next in history for a line matching the current. 519.It Ic ed-prev-line 520Move up one line. 521.It Ic ed-next-line 522Move down one line. 523.It Ic ed-command 524Editline extended command. 525.El 526.\" End of section automatically generated with makelist 527.Sh FILES 528.Bl -tag -width $HOME/.etc/editrc -compact 529.It Pa $PWD/.editrc 530.It Pa $HOME/.etc/editrc 531.El 532.Sh SEE ALSO 533.Xr editline 3 , 534.Xr regex 3 , 535.Xr termcap 5 536.Sh AUTHORS 537The 538.Nm editline 539library was written by Christos Zoulas, 540and this manual was written by Luke Mewburn, 541with some sections inspired by 542.Xr tcsh 1 . 543