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