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