1.\" $OpenBSD: editrc.5,v 1.21 2008/06/26 05:42:05 ray Exp $ 2.\" $NetBSD: editrc.5,v 1.19 2003/11/01 23:35:33 christos 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: June 26 2008 $ 31.Os 32.Dt EDITRC 5 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 87.Xr tcsh 88shell. 89.Pp 90The following builtin commands are available: 91.Bl -tag -width 4n 92.It Ic bind Xo 93.Op Fl aeklrsv 94.Op Ar key Op Ar command 95.Xc 96Without options, list all bound keys, and the editor command to which 97each is bound. 98If 99.Ar key 100is supplied, show the bindings for 101.Ar key . 102If 103.Ar key command 104is supplied, bind 105.Ar command 106to 107.Ar key . 108Options include: 109.Bl -tag -width 4n 110.It Fl a 111List or change key bindings in the 112.Xr vi 1 113mode alternate (command mode) key map. 114.It Fl e 115Bind all keys to the standard GNU Emacs-like bindings. 116.It Fl k 117.Ar key 118is interpreted as a symbolic arrow key name, which may be one of 119.Sq up , 120.Sq down , 121.Sq left 122or 123.Sq right . 124.It Fl l 125List all editor commands and a short description of each. 126.It Fl r 127Remove a key's binding. 128.It Fl s 129.Ar command 130is taken as a literal string and treated as terminal input when 131.Ar key 132is typed. 133Bound keys in 134.Ar command 135are themselves reinterpreted, and this continues for ten levels of 136interpretation. 137.It Fl v 138Bind all keys to the standard 139.Xr vi 1 Ns -like 140bindings. 141.El 142.Pp 143.Ar command 144may be one of the commands documented in 145.Sx "EDITOR COMMANDS" 146below, or another key. 147.Pp 148.Ar key 149and 150.Ar command 151can contain control characters of the form 152.Sm off 153.Sq No ^ Ar character 154.Sm on 155.Po 156e.g.\& 157.Sq ^A 158.Pc , 159and the following backslashed escape sequences: 160.Pp 161.Bl -tag -compact -offset indent -width 4n 162.It Ic \ea 163Bell 164.It Ic \eb 165Backspace 166.It Ic \ee 167Escape 168.It Ic \ef 169Formfeed 170.It Ic \en 171Newline 172.It Ic \er 173Carriage return 174.It Ic \et 175Horizontal tab 176.It Ic \ev 177Vertical tab 178.Sm off 179.It Sy \e Ar nnn 180.Sm on 181The ASCII character corresponding to the octal number 182.Ar nnn . 183.El 184.Pp 185.Sq \e 186nullifies the special meaning of the following character, 187if it has any, notably 188.Sq \e 189and 190.Sq ^ . 191.It Ic echotc Xo 192.Op Fl sv 193.Ar arg 194.Ar ... 195.Xc 196Exercise terminal capabilities given in 197.Ar arg Ar ... . 198If 199.Ar arg 200is 201.Sq baud , 202.Sq cols , 203.Sq lines , 204.Sq rows , 205.Sq meta 206or 207.Sq tabs , 208the value of that capability is printed, with 209.Dq yes 210or 211.Dq no 212indicating that the terminal does or does not have that capability. 213.Pp 214.Fl s 215returns an empty string for non-existent capabilities, rather than 216causing an error. 217.Fl v 218causes messages to be verbose. 219.It Ic edit Op Li on | Li off 220Enable or disable the 221.Nm editline 222functionality in a program. 223.It Ic history 224List the history. 225.It Ic settc Ar cap Ar val 226Set the terminal capability 227.Ar cap 228to 229.Ar val , 230as defined in 231.Xr termcap 5 . 232No sanity checking is done. 233.It Ic setty Xo 234.Op Fl adqx 235.Op Ar +mode 236.Op Ar -mode 237.Op Ar mode 238.Op Ar char=c 239.Xc 240Control which tty modes that 241.Nm 242won't allow the user to change. 243.Fl d , 244.Fl q 245or 246.Fl x 247tells 248.Ic setty 249to act on the 250.Sq edit , 251.Sq quote 252or 253.Sq execute 254set of tty modes respectively; defaulting to 255.Fl x . 256.Pp 257Without other arguments, 258.Ic setty 259lists the modes in the chosen set which are fixed on 260.Po 261.Sq +mode 262.Pc 263or off 264.Po 265.Sq -mode 266.Pc . 267.Fl a 268lists all tty modes in the chosen set regardless of the setting. 269With 270.Ar +mode , 271.Ar -mode 272or 273.Ar mode , 274fixes 275.Ar mode 276on or off or removes control of 277.Ar mode 278in the chosen set. 279.It Ic telltc 280List the values of all the terminal capabilities (see 281.Xr termcap 5 ) . 282.El 283.Sh EDITOR COMMANDS 284The following editor commands are available for use in key bindings: 285.\" Section automatically generated with makelist 286.Bl -tag -width 4n 287.It Ic vi-paste-next 288Vi paste previous deletion to the right of the cursor. 289.It Ic vi-paste-prev 290Vi paste previous deletion to the left of the cursor. 291.It Ic vi-prev-big-word 292Vi move to the previous space delimited word. 293.It Ic vi-prev-word 294Vi move to the previous word. 295.It Ic vi-next-big-word 296Vi move to the next space delimited word. 297.It Ic vi-next-word 298Vi move to the next word. 299.It Ic vi-change-case 300Vi change case of character under the cursor and advance one character. 301.It Ic vi-change-meta 302Vi change prefix command. 303.It Ic vi-insert-at-bol 304Vi enter insert mode at the beginning of line. 305.It Ic vi-replace-char 306Vi replace character under the cursor with the next character typed. 307.It Ic vi-replace-mode 308Vi enter replace mode. 309.It Ic vi-substitute-char 310Vi replace character under the cursor and enter insert mode. 311.It Ic vi-substitute-line 312Vi substitute entire line. 313.It Ic vi-change-to-eol 314Vi change to end of line. 315.It Ic vi-insert 316Vi enter insert mode. 317.It Ic vi-add 318Vi enter insert mode after the cursor. 319.It Ic vi-add-at-eol 320Vi enter insert mode at end of line. 321.It Ic vi-delete-meta 322Vi delete prefix command. 323.It Ic vi-end-big-word 324Vi move to the end of the current space delimited word. 325.It Ic vi-end-word 326Vi move to the end of the current word. 327.It Ic vi-undo 328Vi undo last change. 329.It Ic vi-command-mode 330Vi enter command mode (use alternative key bindings). 331.It Ic vi-zero 332Vi move to the beginning of line. 333.It Ic vi-delete-prev-char 334Vi move to previous character (backspace). 335.It Ic vi-list-or-eof 336Vi list choices for completion or indicate end of file if empty line. 337.It Ic vi-kill-line-prev 338Vi cut from beginning of line to cursor. 339.It Ic vi-search-prev 340Vi search history previous. 341.It Ic vi-search-next 342Vi search history next. 343.It Ic vi-repeat-search-next 344Vi repeat current search in the same search direction. 345.It Ic vi-repeat-search-prev 346Vi repeat current search in the opposite search direction. 347.It Ic vi-next-char 348Vi move to the character specified next. 349.It Ic vi-prev-char 350Vi move to the character specified previous. 351.It Ic vi-to-next-char 352Vi move up to the character specified next. 353.It Ic vi-to-prev-char 354Vi move up to the character specified previous. 355.It Ic vi-repeat-next-char 356Vi repeat current character search in the same search direction. 357.It Ic vi-repeat-prev-char 358Vi repeat current character search in the opposite search direction. 359.It Ic vi-match 360Vi go to matching () {} or []. 361.It Ic vi-undo-line 362Vi undo all changes to line. 363.It Ic vi-to-column 364Vi go to specified column. 365.It Ic vi-yank-end 366Vi yank to end of line. 367.It Ic vi-yank 368Vi yank. 369.It Ic vi-comment-out 370Vi comment out current command. 371.It Ic vi-alias 372Vi include shell alias. 373.It Ic vi-to-history-line 374Vi go to specified history file line.. 375.It Ic vi-histedit 376Vi edit history line with vi. 377.It Ic vi-history-word 378Vi append word from previous input line. 379.It Ic vi-redo 380Vi redo last non-motion command. 381.It Ic em-delete-or-list 382Delete character under cursor or list completions if at end of line. 383.It Ic em-delete-next-word 384Cut from cursor to end of current word. 385.It Ic em-yank 386Paste cut buffer at cursor position. 387.It Ic em-kill-line 388Cut the entire line and save in cut buffer. 389.It Ic em-kill-region 390Cut area between mark and cursor and save in cut buffer. 391.It Ic em-copy-region 392Copy area between mark and cursor to cut buffer. 393.It Ic em-gosmacs-transpose 394Exchange the two characters before the cursor. 395.It Ic em-next-word 396Move next to end of current word. 397.It Ic em-upper-case 398Uppercase the characters from cursor to end of current word. 399.It Ic em-capitol-case 400Capitalize the characters from cursor to end of current word. 401.It Ic em-lower-case 402Lowercase the characters from cursor to end of current word. 403.It Ic em-set-mark 404Set the mark at cursor. 405.It Ic em-exchange-mark 406Exchange the cursor and mark. 407.It Ic em-universal-argument 408Universal argument (argument times 4). 409.It Ic em-meta-next 410Add 8th bit to next character typed. 411.It Ic em-toggle-overwrite 412Switch from insert to overwrite mode or vice versa. 413.It Ic em-copy-prev-word 414Copy current word to cursor. 415.It Ic em-inc-search-next 416Emacs incremental next search. 417.It Ic em-inc-search-prev 418Emacs incremental reverse search. 419.It Ic ed-end-of-file 420Indicate end of file. 421.It Ic ed-insert 422Add character to the line. 423.It Ic ed-delete-prev-word 424Delete from beginning of current word to cursor. 425.It Ic ed-delete-next-char 426Delete character under cursor. 427.It Ic ed-kill-line 428Cut to the end of line. 429.It Ic ed-move-to-end 430Move cursor to the end of line. 431.It Ic ed-move-to-beg 432Move cursor to the beginning of line. 433.It Ic ed-transpose-chars 434Exchange the character to the left of the cursor with the one under it. 435.It Ic ed-next-char 436Move to the right one character. 437.It Ic ed-prev-word 438Move to the beginning of the current word. 439.It Ic ed-prev-char 440Move to the left one character. 441.It Ic ed-quoted-insert 442Add the next character typed verbatim. 443.It Ic ed-digit 444Adds to argument or enters a digit. 445.It Ic ed-argument-digit 446Digit that starts argument. 447.It Ic ed-unassigned 448Indicates unbound character. 449.It Ic ed-tty-sigint 450Tty interrupt character. 451.It Ic ed-tty-dsusp 452Tty delayed suspend character. 453.It Ic ed-tty-flush-output 454Tty flush output characters. 455.It Ic ed-tty-sigquit 456Tty quit character. 457.It Ic ed-tty-sigtstp 458Tty suspend character. 459.It Ic ed-tty-stop-output 460Tty disallow output characters. 461.It Ic ed-tty-start-output 462Tty allow output characters. 463.It Ic ed-newline 464Execute command. 465.It Ic ed-delete-prev-char 466Delete the character to the left of the cursor. 467.It Ic ed-clear-screen 468Clear screen leaving current line at the top. 469.It Ic ed-redisplay 470Redisplay everything. 471.It Ic ed-start-over 472Erase current line and start from scratch. 473.It Ic ed-sequence-lead-in 474First character in a bound sequence. 475.It Ic ed-prev-history 476Move to the previous history line. 477.It Ic ed-next-history 478Move to the next history line. 479.It Ic ed-search-prev-history 480Search previous in history for a line matching the current. 481.It Ic ed-search-next-history 482Search next in history for a line matching the current. 483.It Ic ed-prev-line 484Move up one line. 485.It Ic ed-next-line 486Move down one line. 487.It Ic ed-command 488Editline extended command. 489.El 490.\" End of section automatically generated with makelist 491.Sh SEE ALSO 492.Xr editline 3 , 493.Xr regex 3 , 494.Xr termcap 5 495.Sh AUTHORS 496The 497.Nm editline 498library was written by Christos Zoulas, 499and this manual was written by Luke Mewburn, 500with some sections inspired by 501.Xr tcsh . 502