1*710059bbSuwe.\" $NetBSD: editrc.5,v 1.34 2022/12/06 00:59:20 uwe Exp $ 2b59d3eafSlukem.\" 378dc0c22Slukem.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc. 4b59d3eafSlukem.\" All rights reserved. 5b59d3eafSlukem.\" 6b59d3eafSlukem.\" This file was contributed to The NetBSD Foundation by Luke Mewburn. 7b59d3eafSlukem.\" 8b59d3eafSlukem.\" Redistribution and use in source and binary forms, with or without 9b59d3eafSlukem.\" modification, are permitted provided that the following conditions 10b59d3eafSlukem.\" are met: 11b59d3eafSlukem.\" 1. Redistributions of source code must retain the above copyright 12b59d3eafSlukem.\" notice, this list of conditions and the following disclaimer. 13b59d3eafSlukem.\" 2. Redistributions in binary form must reproduce the above copyright 14b59d3eafSlukem.\" notice, this list of conditions and the following disclaimer in the 15b59d3eafSlukem.\" documentation and/or other materials provided with the distribution. 16b59d3eafSlukem.\" 17b59d3eafSlukem.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18b59d3eafSlukem.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19b59d3eafSlukem.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20990a11b9Sjtc.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21990a11b9Sjtc.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22b59d3eafSlukem.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23b59d3eafSlukem.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24b59d3eafSlukem.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25b59d3eafSlukem.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26b59d3eafSlukem.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27b59d3eafSlukem.\" POSSIBILITY OF SUCH DAMAGE. 28b59d3eafSlukem.\" 2916467be6Schristos.Dd May 22, 2016 30b59d3eafSlukem.Dt EDITRC 5 31997634feSjoerg.Os 32b59d3eafSlukem.Sh NAME 33b59d3eafSlukem.Nm editrc 34b59d3eafSlukem.Nd configuration file for editline library 35b59d3eafSlukem.Sh SYNOPSIS 36b59d3eafSlukem.Nm 37b59d3eafSlukem.Sh DESCRIPTION 38b59d3eafSlukemThe 39b59d3eafSlukem.Nm 40b59d3eafSlukemfile defines various settings to be used by the 41b59d3eafSlukem.Xr editline 3 42b59d3eafSlukemlibrary. 43b59d3eafSlukem.Pp 44cff6006eSlukemThe format of each line is: 45eb157f70Swiz.Pp 46*710059bbSuwe.D1 Oo Ar prog Ns Ic \&: Oc Ns Ar command Oo Ar arg ... Oc 47b59d3eafSlukem.Pp 48b59d3eafSlukem.Ar command 49b59d3eafSlukemis one of the 50b59d3eafSlukem.Xr editline 3 51b59d3eafSlukembuiltin commands. 52b59d3eafSlukemRefer to 53b59d3eafSlukem.Sx BUILTIN COMMANDS 54b59d3eafSlukemfor more information. 55b59d3eafSlukem.Pp 56b59d3eafSlukem.Ar prog 57b59d3eafSlukemis the program name string that a program defines when it calls 58b59d3eafSlukem.Xr el_init 3 59b59d3eafSlukemto set up 60b59d3eafSlukem.Xr editline 3 , 61b59d3eafSlukemwhich is usually 62*710059bbSuwe.Va argv Ns Li [0] . 63b59d3eafSlukem.Ar command 64b59d3eafSlukemwill be executed for any program which matches 65b59d3eafSlukem.Ar prog . 66b59d3eafSlukem.Pp 67b59d3eafSlukem.Ar prog 68b59d3eafSlukemmay also be a 69b59d3eafSlukem.Xr regex 3 70b59d3eafSlukemstyle 71b59d3eafSlukemregular expression, in which case 72b59d3eafSlukem.Ar command 73b59d3eafSlukemwill be executed for any program that matches the regular expression. 74cff6006eSlukem.Pp 75cff6006eSlukemIf 76cff6006eSlukem.Ar prog 77cff6006eSlukemis absent, 78cff6006eSlukem.Ar command 79cff6006eSlukemis executed for all programs. 80b59d3eafSlukem.Sh BUILTIN COMMANDS 81b59d3eafSlukemThe 82b59d3eafSlukem.Nm editline 83b59d3eafSlukemlibrary has some builtin commands, which affect the way 84b59d3eafSlukemthat the line editing and history functions operate. 85b59d3eafSlukemThese are based on similar named builtins present in the 86b59d3eafSlukem.Xr tcsh 1 87b59d3eafSlukemshell. 88b59d3eafSlukem.Pp 89b59d3eafSlukemThe following builtin commands are available: 90b59d3eafSlukem.Bl -tag -width 4n 9116467be6Schristos.It Ic bind Oo Fl aeklrsv Oc Op Ar key Op Ar command 9216467be6SchristosWithout options and arguments, list all bound keys and macros, and 9316467be6Schristosthe editor command or input string to which each one is bound. 9416467be6SchristosIf only 95b59d3eafSlukem.Ar key 9616467be6Schristosis supplied, show the binding for that key or macro. 97b59d3eafSlukemIf 98b59d3eafSlukem.Ar key command 9916467be6Schristosis supplied, bind the editor 100b59d3eafSlukem.Ar command 10116467be6Schristosto that key or macro. 10216467be6Schristos.Pp 10316467be6SchristosThe options are as follows: 104b59d3eafSlukem.Bl -tag -width 4n 105b59d3eafSlukem.It Fl a 106b59d3eafSlukemList or change key bindings in the 107b59d3eafSlukem.Xr vi 1 108b59d3eafSlukemmode alternate (command mode) key map. 109eb157f70Swiz.It Fl e 110*710059bbSuweBind all keys to the standard 111*710059bbSuwe.Tn GNU 112*710059bbSuweEmacs-like bindings. 113b59d3eafSlukem.It Fl k 114b59d3eafSlukem.Ar key 115b59d3eafSlukemis interpreted as a symbolic arrow key name, which may be one of 116*710059bbSuwe.Ic up , 117*710059bbSuwe.Ic down , 118*710059bbSuwe.Ic left 119b59d3eafSlukemor 120*710059bbSuwe.Ic right . 121b59d3eafSlukem.It Fl l 122b59d3eafSlukemList all editor commands and a short description of each. 123b59d3eafSlukem.It Fl r 12416467be6SchristosRemove the binding of the key or macro 12516467be6Schristos.Ar key . 126b59d3eafSlukem.It Fl s 12716467be6SchristosDefine a keyboard macro rather than a key binding or command macro: 128b59d3eafSlukem.Ar command 12916467be6Schristosis taken as a literal string and appended to the input queue whenever 130b59d3eafSlukem.Ar key 131b59d3eafSlukemis typed. 13216467be6SchristosBound keys and macros in 133b59d3eafSlukem.Ar command 134b59d3eafSlukemare themselves reinterpreted, and this continues for ten levels of 135b59d3eafSlukeminterpretation. 136eb157f70Swiz.It Fl v 137eb157f70SwizBind all keys to the standard 138eb157f70Swiz.Xr vi 1 Ns -like 139eb157f70Swizbindings. 140b59d3eafSlukem.El 1415785f636Slukem.Pp 14216467be6SchristosThe 143067b3315Schristos.Xr editline 7 14416467be6Schristosmanual documents all editor commands and contains more information 14516467be6Schristosabout macros and the input queue. 14678dc0c22Slukem.Pp 1475785f636Slukem.Ar key 1485785f636Slukemand 1495785f636Slukem.Ar command 1505785f636Slukemcan contain control characters of the form 151*710059bbSuwe.Sq Ic ^ Ns Ar character 1525785f636Slukem.Po 153eb157f70Swize.g.\& 154*710059bbSuwe.Ql ^A 1555785f636Slukem.Pc , 1565785f636Slukemand the following backslashed escape sequences: 1575785f636Slukem.Pp 158*710059bbSuwe.Bl -tag -compact -offset indent -width Ic 1595785f636Slukem.It Ic \ea 1605785f636SlukemBell 1615785f636Slukem.It Ic \eb 1625785f636SlukemBackspace 1635785f636Slukem.It Ic \ee 1645785f636SlukemEscape 1655785f636Slukem.It Ic \ef 1665785f636SlukemFormfeed 1675785f636Slukem.It Ic \en 1685785f636SlukemNewline 1695785f636Slukem.It Ic \er 1705785f636SlukemCarriage return 1715785f636Slukem.It Ic \et 1725785f636SlukemHorizontal tab 1735785f636Slukem.It Ic \ev 1745785f636SlukemVertical tab 1755785f636Slukem.Sm off 176*710059bbSuwe.It Ic \e Ar nnn 1775785f636Slukem.Sm on 178*710059bbSuweThe 179*710059bbSuwe.Tn ASCII 180*710059bbSuwecharacter corresponding to the octal number 1815785f636Slukem.Ar nnn . 1825785f636Slukem.El 1835785f636Slukem.Pp 184*710059bbSuwe.Ql \e 1855785f636Slukemnullifies the special meaning of the following character, 1865785f636Slukemif it has any, notably 187*710059bbSuwe.Ql \e 1885785f636Slukemand 189*710059bbSuwe.Ql ^ . 190dab0ac30Sjoerg.It Ic echotc Oo Fl sv Oc Ar arg Ar ... 191b59d3eafSlukemExercise terminal capabilities given in 192*710059bbSuwe.Ar arg . 193b59d3eafSlukemIf 194b59d3eafSlukem.Ar arg 195b59d3eafSlukemis 196*710059bbSuwe.Ql baud , 197*710059bbSuwe.Ql cols , 198*710059bbSuwe.Ql lines , 199*710059bbSuwe.Ql rows , 200*710059bbSuwe.Ql meta , 201d4890354Swizor 202*710059bbSuwe.Ql tabs , 203b59d3eafSlukemthe value of that capability is printed, with 204b59d3eafSlukem.Dq yes 205b59d3eafSlukemor 206b59d3eafSlukem.Dq no 207b59d3eafSlukemindicating that the terminal does or does not have that capability. 208b59d3eafSlukem.Pp 209b59d3eafSlukem.Fl s 210489a979dSwizreturns an empty string for non-existent capabilities, rather than 211b59d3eafSlukemcausing an error. 212b59d3eafSlukem.Fl v 213b59d3eafSlukemcauses messages to be verbose. 214*710059bbSuwe.It Ic edit Op Li on No | Li off 215f87d2504SlukemEnable or disable the 216f87d2504Slukem.Nm editline 217f87d2504Slukemfunctionality in a program. 218*710059bbSuwe.It Ic history Li list No | Li size Ar n No | Li unique Ar n 2194c93d52cSchristosThe 220*710059bbSuwe.Ql list 2214c93d52cSchristoscommand lists all entries in the history. 2224c93d52cSchristosThe 223*710059bbSuwe.Ql size 2244c93d52cSchristoscommand sets the history size to 225*710059bbSuwe.Ar n 2264c93d52cSchristosentries. 2274c93d52cSchristosThe 228*710059bbSuwe.Ql unique 2294c93d52cSchristoscommand controls if history should keep duplicate entries. 2304c93d52cSchristosIf 231*710059bbSuwe.Ar n 2324c93d52cSchristosis non zero, only keep unique history entries. 2334c93d52cSchristosIf 234*710059bbSuwe.Ar n 2354c93d52cSchristosis zero, then keep all entries (the default). 236b59d3eafSlukem.It Ic settc Ar cap Ar val 237b59d3eafSlukemSet the terminal capability 238b59d3eafSlukem.Ar cap 239b59d3eafSlukemto 240b59d3eafSlukem.Ar val , 241b59d3eafSlukemas defined in 242b59d3eafSlukem.Xr termcap 5 . 243b59d3eafSlukemNo sanity checking is done. 244*710059bbSuwe.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ic \&+ Ns Ar mode Oc \ 245*710059bbSuweOo Fl Ar mode Oc Oo Ar mode Oc Oo Ar char\| Ns Ic = Ns Ar c Oc 246b59d3eafSlukemControl which tty modes that 247b59d3eafSlukem.Nm 248b59d3eafSlukemwon't allow the user to change. 249b59d3eafSlukem.Fl d , 250b59d3eafSlukem.Fl q 251b59d3eafSlukemor 252b59d3eafSlukem.Fl x 253b59d3eafSlukemtells 254b59d3eafSlukem.Ic setty 255b59d3eafSlukemto act on the 256b59d3eafSlukem.Sq edit , 257b59d3eafSlukem.Sq quote 258b59d3eafSlukemor 259b59d3eafSlukem.Sq execute 260b59d3eafSlukemset of tty modes respectively; defaulting to 261b59d3eafSlukem.Fl x . 262b59d3eafSlukem.Pp 263b59d3eafSlukemWithout other arguments, 264b59d3eafSlukem.Ic setty 265b59d3eafSlukemlists the modes in the chosen set which are fixed on 266b59d3eafSlukem.Po 267*710059bbSuwe.Ic + Ns Ar mode 268b59d3eafSlukem.Pc 269b59d3eafSlukemor off 270b59d3eafSlukem.Po 271*710059bbSuwe.Fl Ns Ar mode 272b59d3eafSlukem.Pc . 273b59d3eafSlukem.Fl a 274b59d3eafSlukemlists all tty modes in the chosen set regardless of the setting. 275b59d3eafSlukemWith 276*710059bbSuwe.Ic + Ns Ar mode , 277*710059bbSuwe.Fl Ns Ar mode 278b59d3eafSlukemor 279b59d3eafSlukem.Ar mode , 280b59d3eafSlukemfixes 281b59d3eafSlukem.Ar mode 282b59d3eafSlukemon or off or removes control of 283b59d3eafSlukem.Ar mode 284b59d3eafSlukemin the chosen set. 285730f23e5Schristos.Pp 286730f23e5Schristos.Ic Setty 287730f23e5Schristoscan also be used to set tty characters to particular values using 288*710059bbSuwe.Ar char\| Ns Ic = Ns Ar value . 289730f23e5SchristosIf 290730f23e5Schristos.Ar value 291730f23e5Schristosis empty 292730f23e5Schristosthen the character is set to 293730f23e5Schristos.Dv _POSIX_VDISABLE . 294eb157f70Swiz.It Ic telltc 295eb157f70SwizList the values of all the terminal capabilities (see 296eb157f70Swiz.Xr termcap 5 ) . 297b59d3eafSlukem.El 29800f36e26Skre.Sh ENVIRONMENT 299*710059bbSuwe.Bl -tag -width Ev 30000f36e26Skre.It Ev EDITRC 30100f36e26SkreNames the default configuration file for the 30200f36e26Skre.Xr editline 3 30300f36e26Skrelibrary. 30400f36e26Skre.El 305ec73a081Swiz.Sh FILES 306*710059bbSuwe.Bl -tag -width Pa 307ec73a081Swiz.It Pa ~/.editrc 308*710059bbSuweLast resort user configuration file for the 309ec73a081Swiz.Xr editline 3 310*710059bbSuwelibrary if no other file is specified. 311ec73a081Swiz.El 312b59d3eafSlukem.Sh SEE ALSO 313b59d3eafSlukem.Xr editline 3 , 314b59d3eafSlukem.Xr regex 3 , 315067b3315Schristos.Xr termcap 5 , 316067b3315Schristos.Xr editline 7 317b59d3eafSlukem.Sh AUTHORS 318eb157f70Swiz.An -nosplit 319b59d3eafSlukemThe 3206e4fef04Schristos.Nm editline 321eb157f70Swizlibrary was written by 322eb157f70Swiz.An Christos Zoulas , 323eb157f70Swizand this manual was written by 324eb157f70Swiz.An Luke Mewburn , 325b59d3eafSlukemwith some sections inspired by 326b59d3eafSlukem.Xr tcsh 1 . 327