editrc.5 12 KB

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