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