1*0c83befaSchristos.\" $NetBSD: editline.7,v 1.6 2024/04/06 13:36:11 christos Exp $ 2067b3315Schristos.\" $OpenBSD: editline.7,v 1.1 2016/04/20 01:11:45 schwarze Exp $ 3067b3315Schristos.\" 4067b3315Schristos.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 5067b3315Schristos.\" 6067b3315Schristos.\" Permission to use, copy, modify, and distribute this software for any 7067b3315Schristos.\" purpose with or without fee is hereby granted, provided that the above 8067b3315Schristos.\" copyright notice and this permission notice appear in all copies. 9067b3315Schristos.\" 10067b3315Schristos.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11067b3315Schristos.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12067b3315Schristos.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13067b3315Schristos.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14067b3315Schristos.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15067b3315Schristos.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16067b3315Schristos.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17067b3315Schristos.\" 18*0c83befaSchristos.Dd April 6, 2024 19067b3315Schristos.Dt EDITLINE 7 20067b3315Schristos.Os 21067b3315Schristos.Sh NAME 22067b3315Schristos.Nm editline 23067b3315Schristos.Nd line editing user interface 24067b3315Schristos.Sh DESCRIPTION 25067b3315SchristosWhen a program using the 26067b3315Schristos.Xr editline 3 27067b3315Schristoslibrary prompts for an input string using the function 28067b3315Schristos.Xr el_wgets 3 , 29067b3315Schristosit reads characters from the terminal. 30067b3315SchristosInvalid input bytes that do not form characters are silently 31067b3315Schristosdiscarded. 32067b3315SchristosFor each character read, one editor command is executed. 33067b3315SchristosThe mapping of input characters to editor commands depends on the 34067b3315Schristosediting mode. 35067b3315SchristosThere are three editing modes: vi insert mode, vi command mode, 36067b3315Schristosand emacs mode. 37067b3315SchristosThe default is vi insert mode. 38067b3315SchristosThe program can switch the default to emacs mode by using the 39067b3315Schristos.Xr el_set 3 40067b3315Schristosor 41067b3315Schristos.Xr el_parse 3 42067b3315Schristosfunctions, and the user can switch to emacs mode either in the 43067b3315Schristos.Xr editrc 5 44067b3315Schristosconfiguration file or interactively with the 45067b3315Schristos.Ic ed-command 46067b3315Schristoseditor command, in all three cases executing the 47067b3315Schristos.Ic bind Fl e 48067b3315Schristosbuiltin command. 49067b3315Schristos.Pp 50067b3315SchristosIf trying to read from the terminal results in end of file or an 51067b3315Schristoserror, the library signals end of file to the program and does not 52067b3315Schristosreturn a string. 53067b3315Schristos.Ss Input character bindings 54067b3315SchristosAll default bindings described below can be overridden by individual 55067b3315Schristosprograms and can be changed with the 56067b3315Schristos.Xr editrc 5 57067b3315Schristos.Ic bind 58067b3315Schristosbuiltin command. 59067b3315Schristos.Pp 60067b3315SchristosIn the following tables, 61067b3315Schristos.Sq Ctrl- 62067b3315Schristosindicates a character with the bit 0x40 flipped, and 63067b3315Schristos.Sq Meta- 64067b3315Schristosindicates a character with the bit 0x80 set. 65067b3315SchristosIn vi insert mode and in emacs mode, all Meta-characters considered 66067b3315Schristosprintable by the current 67067b3315Schristos.Xr locale 1 68067b3315Schristosare bound to 69067b3315Schristos.Ic ed-insert 70067b3315Schristosinstead of to the editor command listed below. 71067b3315SchristosConsequently, in UTF-8 mode, most of the Meta-characters are not 72067b3315Schristosdirectly accessible because their code points are occupied by 73067b3315Schristosprintable Unicode characters, and Meta-characters are usually input 74067b3315Schristosusing the 75067b3315Schristos.Ic em-meta-next 76067b3315Schristoseditor command. 77067b3315SchristosFor example, to enter 78067b3315Schristos.Sq Meta-B 79067b3315Schristosin order to call the 80067b3315Schristos.Ic ed-prev-word 81067b3315Schristoseditor command in emacs mode, call 82067b3315Schristos.Ic em-meta-next 83067b3315Schristosby pressing and releasing the escape key (or equivalently, Ctrl-[), 84067b3315Schristosthen press and release the 85067b3315Schristos.Sq B 86067b3315Schristoskey. 87067b3315SchristosIf you have configured a Meta-key on your keyboard, for example 88067b3315Schristoswith 89067b3315Schristos.Ql setxkbmap -option altwin:left_meta_win , 90067b3315Schristosthe Ctrl-Meta-characters are directly accessible. 91067b3315SchristosFor example, to enter 92067b3315Schristos.Sq Ctrl-Meta-H 93067b3315Schristosin order to call the 94067b3315Schristos.Ic ed-delete-prev-word 95067b3315Schristoseditor command in emacs mode, hold down the keys 96067b3315Schristos.Sq Ctrl , 97067b3315Schristos.Sq Meta , 98067b3315Schristosand 99067b3315Schristos.Sq H 100067b3315Schristosat the same time. 101067b3315SchristosAlternatively, press and release the escape key, then press and 102067b3315Schristosrelease 103067b3315Schristos.Sq Ctrl-H . 104067b3315Schristos.Pp 105067b3315SchristosIn vi input mode, input characters are bound to the following editor 106067b3315Schristoscommands by default: 107067b3315Schristos.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history" 108067b3315Schristos.It Ctrl-D, EOF Ta Ic vi-list-or-eof 109067b3315Schristos.It Ctrl-H, BS Ta Ic vi-delete-prev-char 110067b3315Schristos.It Ctrl-J, LF Ta Ic ed-newline 111067b3315Schristos.It Ctrl-M, CR Ta Ic ed-newline 112067b3315Schristos.It Ctrl-Q Ta Ic ed-tty-start-output 113067b3315Schristos.It Ctrl-S Ta Ic ed-tty-stop-output 114067b3315Schristos.It Ctrl-U Ta Ic vi-kill-line-prev 115067b3315Schristos.It Ctrl-V Ta Ic ed-quoted-insert 116067b3315Schristos.It Ctrl-W Ta Ic ed-delete-prev-word 117067b3315Schristos.It Ctrl-[, ESC Ta Ic vi-command-mode 118067b3315Schristos.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit 119067b3315Schristos.It Ctrl-?, DEL Ta Ic vi-delete-prev-char 120067b3315Schristos.El 121067b3315Schristos.Pp 122067b3315SchristosAll other input characters except the NUL character (Ctrl-@) are 123067b3315Schristosbound to 124067b3315Schristos.Ic ed-insert . 125067b3315Schristos.Pp 126067b3315SchristosIn vi command mode, input characters are bound to the following 127067b3315Schristoseditor commands by default: 128067b3315Schristos.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history" 129067b3315Schristos.It Ctrl-A Ta Ic ed-move-to-beg 130067b3315Schristos.It Ctrl-C, INT Ta Ic ed-tty-sigint 131067b3315Schristos.It Ctrl-E Ta Ic ed-move-to-end 132067b3315Schristos.It Ctrl-H, BS Ta Ic ed-delete-prev-char 133067b3315Schristos.It Ctrl-J, LF Ta Ic ed-newline 134067b3315Schristos.It Ctrl-K Ta Ic ed-kill-line 135067b3315Schristos.It Ctrl-L, FF Ta Ic ed-clear-screen 136067b3315Schristos.It Ctrl-M, CR Ta Ic ed-newline 137067b3315Schristos.It Ctrl-N Ta Ic ed-next-history 138067b3315Schristos.It Ctrl-O Ta Ic ed-tty-flush-output 139067b3315Schristos.It Ctrl-P Ta Ic ed-prev-history 140067b3315Schristos.It Ctrl-Q Ta Ic ed-tty-start-output 141067b3315Schristos.It Ctrl-R Ta Ic ed-redisplay 142067b3315Schristos.It Ctrl-S Ta Ic ed-tty-stop-output 143067b3315Schristos.It Ctrl-U Ta Ic vi-kill-line-prev 144067b3315Schristos.It Ctrl-W Ta Ic ed-delete-prev-word 145067b3315Schristos.It Ctrl-[, ESC Ta Ic em-meta-next 146067b3315Schristos.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit 147067b3315Schristos.It Space Ta Ic ed-next-char 148067b3315Schristos.It # Ta Ic vi-comment-out 149067b3315Schristos.It $ Ta Ic ed-move-to-end 150067b3315Schristos.It % Ta Ic vi-match 151067b3315Schristos.It + Ta Ic ed-next-history 152067b3315Schristos.It \&, Ta Ic vi-repeat-prev-char 153067b3315Schristos.It - Ta Ic ed-prev-history 154067b3315Schristos.It \&. Ta Ic vi-redo 155067b3315Schristos.It / Ta Ic vi-search-prev 156067b3315Schristos.It 0 Ta Ic vi-zero 157067b3315Schristos.It 1 to 9 Ta Ic ed-argument-digit 158067b3315Schristos.It \&: Ta Ic ed-command 159067b3315Schristos.It \&; Ta Ic vi-repeat-next-char 160067b3315Schristos.It \&? Ta Ic vi-search-next 161067b3315Schristos.It @ Ta Ic vi-alias 162067b3315Schristos.It A Ta Ic vi-add-at-eol 163067b3315Schristos.It B Ta Ic vi-prev-big-word 164067b3315Schristos.It C Ta Ic vi-change-to-eol 165067b3315Schristos.It D Ta Ic ed-kill-line 166067b3315Schristos.It E Ta Ic vi-end-big-word 167067b3315Schristos.It F Ta Ic vi-prev-char 168067b3315Schristos.It G Ta Ic vi-to-history-line 169067b3315Schristos.It I Ta Ic vi-insert-at-bol 170067b3315Schristos.It J Ta Ic ed-search-next-history 171067b3315Schristos.It K Ta Ic ed-search-prev-history 172067b3315Schristos.It N Ta Ic vi-repeat-search-prev 173067b3315Schristos.It O Ta Ic ed-sequence-lead-in 174067b3315Schristos.It P Ta Ic vi-paste-prev 175067b3315Schristos.It R Ta Ic vi-replace-mode 176067b3315Schristos.It S Ta Ic vi-substitute-line 177067b3315Schristos.It T Ta Ic vi-to-prev-char 178067b3315Schristos.It U Ta Ic vi-undo-line 179067b3315Schristos.It W Ta Ic vi-next-big-word 180067b3315Schristos.It X Ta Ic ed-delete-prev-char 181067b3315Schristos.It Y Ta Ic vi-yank-end 182067b3315Schristos.It \&[ Ta Ic ed-sequence-lead-in 183067b3315Schristos.It ^ Ta Ic ed-move-to-beg 184067b3315Schristos.It _ Ta Ic vi-history-word 185067b3315Schristos.It a Ta Ic vi-add 186067b3315Schristos.It b Ta Ic vi-prev-word 187067b3315Schristos.It c Ta Ic vi-change-meta 188067b3315Schristos.It d Ta Ic vi-delete-meta 189067b3315Schristos.It e Ta Ic vi-end-word 190067b3315Schristos.It f Ta Ic vi-next-char 191067b3315Schristos.It h Ta Ic ed-prev-char 192067b3315Schristos.It i Ta Ic vi-insert 193067b3315Schristos.It j Ta Ic ed-next-history 194067b3315Schristos.It k Ta Ic ed-prev-history 195067b3315Schristos.It l Ta Ic ed-next-char 196067b3315Schristos.It n Ta Ic vi-repeat-search-next 197067b3315Schristos.It p Ta Ic vi-paste-next 198067b3315Schristos.It r Ta Ic vi-replace-char 199067b3315Schristos.It s Ta Ic vi-substitute-char 200067b3315Schristos.It t Ta Ic vi-to-next-char 201067b3315Schristos.It u Ta Ic vi-undo 202067b3315Schristos.It v Ta Ic vi-histedit 203067b3315Schristos.It w Ta Ic vi-next-word 204067b3315Schristos.It x Ta Ic ed-delete-next-char 205067b3315Schristos.It y Ta Ic vi-yank 206067b3315Schristos.It \&| Ta Ic vi-to-column 207067b3315Schristos.It ~ Ta Ic vi-change-case 208067b3315Schristos.It Ctrl-?, DEL Ta Ic ed-delete-prev-char 209067b3315Schristos.It Meta-O Ta Ic ed-sequence-lead-in 210067b3315Schristos.It Meta-[ Ta Ic ed-sequence-lead-in 211067b3315Schristos.El 212067b3315Schristos.Pp 213067b3315SchristosIn emacs mode, input characters are bound to the following editor 214067b3315Schristoscommands by default: 215067b3315Schristos.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history" 216067b3315Schristos.It 0 to 9 Ta Ic ed-digit 217067b3315Schristos.It Ctrl-@, NUL Ta Ic em-set-mark 218067b3315Schristos.It Ctrl-A Ta Ic ed-move-to-beg 219067b3315Schristos.It Ctrl-B Ta Ic ed-prev-char 220067b3315Schristos.It Ctrl-C, INT Ta Ic ed-tty-sigint 221067b3315Schristos.It Ctrl-D, EOF Ta Ic em-delete-or-list 222067b3315Schristos.It Ctrl-E Ta Ic ed-move-to-end 223067b3315Schristos.It Ctrl-F Ta Ic ed-next-char 224067b3315Schristos.It Ctrl-H, BS Ta Ic em-delete-prev-char 225067b3315Schristos.It Ctrl-J, LF Ta Ic ed-newline 226067b3315Schristos.It Ctrl-K Ta Ic ed-kill-line 227067b3315Schristos.It Ctrl-L, FF Ta Ic ed-clear-screen 228067b3315Schristos.It Ctrl-M, CR Ta Ic ed-newline 229067b3315Schristos.It Ctrl-N Ta Ic ed-next-history 230067b3315Schristos.It Ctrl-O Ta Ic ed-tty-flush-output 231067b3315Schristos.It Ctrl-P Ta Ic ed-prev-history 232067b3315Schristos.It Ctrl-Q Ta Ic ed-tty-start-output 233067b3315Schristos.It Ctrl-R Ta Ic ed-redisplay 234067b3315Schristos.It Ctrl-S Ta Ic ed-tty-stop-output 235067b3315Schristos.It Ctrl-T Ta Ic ed-transpose-chars 236067b3315Schristos.It Ctrl-U Ta Ic ed-kill-line 237067b3315Schristos.It Ctrl-V Ta Ic ed-quoted-insert 238067b3315Schristos.It Ctrl-W Ta Ic em-kill-region 239067b3315Schristos.It Ctrl-X Ta Ic ed-sequence-lead-in 240067b3315Schristos.It Ctrl-Y Ta Ic em-yank 241067b3315Schristos.It Ctrl-Z, TSTP Ta Ic ed-tty-sigtstp 242067b3315Schristos.It Ctrl-[, ESC Ta Ic em-meta-next 243067b3315Schristos.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit 244067b3315Schristos.It Ctrl-] Ta Ic ed-tty-dsusp 245067b3315Schristos.It Ctrl-?, DEL Ta Ic em-delete-prev-char 246067b3315Schristos.It Ctrl-Meta-H Ta Ic ed-delete-prev-word 247067b3315Schristos.It Ctrl-Meta-L Ta Ic ed-clear-screen 248067b3315Schristos.It Ctrl-Meta-_ Ta Ic em-copy-prev-word 249067b3315Schristos.It Meta-0 to 9 Ta Ic ed-argument-digit 250067b3315Schristos.It Meta-B Ta Ic ed-prev-word 251067b3315Schristos.It Meta-C Ta Ic em-capitol-case 252067b3315Schristos.It Meta-D Ta Ic em-delete-next-word 253067b3315Schristos.It Meta-F Ta Ic em-next-word 254067b3315Schristos.It Meta-L Ta Ic em-lower-case 255067b3315Schristos.It Meta-N Ta Ic ed-search-next-history 256067b3315Schristos.It Meta-O Ta Ic ed-sequence-lead-in 257067b3315Schristos.It Meta-P Ta Ic ed-search-prev-history 258067b3315Schristos.It Meta-U Ta Ic em-upper-case 259067b3315Schristos.It Meta-W Ta Ic em-copy-region 260067b3315Schristos.It Meta-X Ta Ic ed-command 261067b3315Schristos.It Meta-[ Ta Ic ed-sequence-lead-in 262067b3315Schristos.It Meta-b Ta Ic ed-prev-word 263067b3315Schristos.It Meta-c Ta Ic em-capitol-case 264067b3315Schristos.It Meta-d Ta Ic em-delete-next-word 265067b3315Schristos.It Meta-f Ta Ic em-next-word 266067b3315Schristos.It Meta-l Ta Ic em-lower-case 267067b3315Schristos.It Meta-n Ta Ic ed-search-next-history 268067b3315Schristos.It Meta-p Ta Ic ed-search-prev-history 269067b3315Schristos.It Meta-u Ta Ic em-upper-case 270067b3315Schristos.It Meta-w Ta Ic em-copy-region 271067b3315Schristos.It Meta-x Ta Ic ed-command 272067b3315Schristos.It Ctrl-Meta-? Ta Ic ed-delete-prev-word 273067b3315Schristos.El 274067b3315Schristos.Pp 275067b3315SchristosThe remaining 276067b3315Schristos.Xr ascii 7 277067b3315Schristoscharacters in the range 0x20 to 0x7e are bound to 278067b3315Schristos.Ic ed-insert . 279067b3315Schristos.Pp 280067b3315SchristosIf standard output is not connected to a terminal device 281067b3315Schristosor 282067b3315Schristos.Xr el_set 3 283067b3315Schristoswas used to set 284067b3315Schristos.Dv EL_EDITMODE 285067b3315Schristosto 0, all input character bindings are disabled and all characters 286067b3315Schristostyped are appended to the edit buffer. 287067b3315SchristosIn that case, the edit buffer is returned to the program after a 288067b3315Schristosnewline or carriage return character is typed, or after the first 289067b3315Schristoscharacter typed if 290067b3315Schristos.Xr el_set 3 291067b3315Schristoswas used to set 292067b3315Schristos.Dv EL_UNBUFFERED 293067b3315Schristosto non-zero. 294067b3315Schristos.Ss Editor commands 295067b3315SchristosMost editor commands accept an optional argument. 296067b3315SchristosThe argument is entered by prefixing the editor command with one 297067b3315Schristosor more of the editor commands 298067b3315Schristos.Ic ed-argument-digit , 299067b3315Schristos.Ic ed-digit , 300067b3315Schristos.Ic em-universal-argument , 301067b3315Schristosor 302067b3315Schristos.Ic vi-zero . 303067b3315SchristosWhen an argument is not provided, it defaults to 1. 304067b3315SchristosFor most editor commands, the effect of an argument is to repeatedly 305067b3315Schristosexecute the command that number of times. 306067b3315Schristos.Pp 307067b3315SchristosWhen talking about a character string from a left character to a 308067b3315Schristosright character, the left character is included in the string, while 309067b3315Schristosthe right character is not included. 310067b3315Schristos.Pp 311067b3315SchristosIf an editor command causes an error, the input character is discarded, 312067b3315Schristosno action occurs, and the terminal bell is rung. 313067b3315SchristosIn case of a non-fatal error, the terminal bell is also rung, 314067b3315Schristosbut the editor command takes effect anyway. 315067b3315Schristos.Pp 316067b3315SchristosIn the following list, the default key bindings are listed after 317067b3315Schristoseach editor command. 318067b3315Schristos.Bl -tag -width 4n 319067b3315Schristos.It Ic ed-argument-digit Pq vi command: 1 to 9; emacs: Meta-0 to Meta-9 320067b3315SchristosIf in argument input mode, append the input digit to the argument 321067b3315Schristosbeing read. 322067b3315SchristosOtherwise, switch to argument input mode and use the input digit 323067b3315Schristosas the most significant digit of the argument. 324067b3315SchristosIt is an error if the input character is not a digit or if the 325067b3315Schristosexisting argument is already greater than a million. 326067b3315Schristos.It Ic ed-clear-screen Pq vi command: Ctrl-L; emacs: Ctrl-L, Ctrl-Meta-L 327067b3315SchristosClear the screen and display the edit buffer at the top. 328067b3315SchristosIgnore any argument. 329067b3315Schristos.It Ic ed-command Pq vi command: So \&: Sc ; emacs: Meta-X, Meta-x 330067b3315SchristosRead a line from the terminal bypassing the normal line editing 331067b3315Schristosfunctionality and execute that line as an 332067b3315Schristos.Xr editrc 5 333067b3315Schristosbuiltin command. 334067b3315SchristosIf in vi command mode, also switch back to vi insert mode. 335067b3315SchristosIgnore any argument. 336067b3315Schristos.It Ic ed-delete-next-char Pq vi command: x 337067b3315SchristosDelete the character at the cursor position. 338067b3315SchristosWith an argument, delete that number of characters. 339067b3315SchristosIn emacs mode, it is an error if the cursor is at the end of the 340067b3315Schristosedit buffer. 341067b3315SchristosIn vi mode, the last character in the edit buffer is deleted in 342067b3315Schristosthat case, and it is an error if the buffer is empty. 343067b3315Schristos.It Ic ed-delete-prev-char Pq vi command: X, Ctrl-H, BS, Ctrl-?, DEL 344067b3315SchristosDelete the character to the left of the cursor position. 345067b3315SchristosWith an argument, delete that number of characters. 346067b3315SchristosIt is an error if the cursor is at the beginning of the edit buffer. 347067b3315Schristos.It Ic ed-delete-prev-word Pq vi: Ctrl-W; emacs: Ctrl-Meta-H, Ctrl-Meta-? 348067b3315SchristosMove to the left to the closest beginning of a word, delete the 349067b3315Schristosstring from that position to the cursor, and save it to the cut 350067b3315Schristosbuffer. 351067b3315SchristosWith an argument, delete that number of words. 352067b3315SchristosIt is an error if the cursor is at the beginning of the edit buffer. 353067b3315Schristos.It Ic ed-digit Pq emacs: 0 to 9 354067b3315SchristosIf in argument input mode, append the input digit to the argument 355067b3315Schristosbeing read. 356067b3315SchristosOtherwise, call 357067b3315Schristos.Ic ed-insert . 358067b3315SchristosIt is an error if the input character is not a digit or if the 359067b3315Schristosexisting argument is already greater than a million. 360067b3315Schristos.It Ic ed-end-of-file Pq not bound by default 361067b3315SchristosDiscard the edit buffer and indicate end of file to the program. 362067b3315SchristosIgnore any argument. 363067b3315Schristos.It Ic ed-ignore Pq various 364067b3315SchristosDiscard the input character and do nothing. 365067b3315Schristos.It Ic ed-insert Pq vi input: almost all; emacs: printable characters 366067b3315SchristosIn insert mode, insert the input character left of the cursor 367067b3315Schristosposition. 368067b3315SchristosIn replace mode, overwrite the character at the cursor and move the 369067b3315Schristoscursor to the right by one character position. 370067b3315SchristosAccept an argument to do this repeatedly. 371067b3315SchristosIt is an error if the input character is the NUL character (Ctrl-@). 372067b3315SchristosFailure to enlarge the edit buffer also results in an error. 373067b3315Schristos.It Ic ed-kill-line Pq vi command: D, Ctrl-K; emacs: Ctrl-K, Ctrl-U 374067b3315SchristosDelete the string from the cursor position to the end of the line 375067b3315Schristosand save it to the cut buffer. 376067b3315SchristosIgnore any argument. 377067b3315Schristos.It Ic ed-move-to-beg Pq vi command: ^, Ctrl-A; emacs: Ctrl-A 378067b3315SchristosIn vi mode, move the cursor to the first non-space character in the 379067b3315Schristosedit buffer. 380067b3315SchristosIn emacs mode, move the cursor to the beginning of the edit buffer. 381067b3315SchristosIgnore any argument. 382067b3315SchristosCan be used as a movement command after 383067b3315Schristos.Ic vi_change_meta , 384067b3315Schristos.Ic vi_delete_meta , 385067b3315Schristosor 386067b3315Schristos.Ic vi_yank . 387067b3315Schristos.It Ic ed-move-to-end Pq vi command: $, Ctrl-E; emacs: Ctrl-E 388067b3315SchristosMove the cursor to the end of the edit buffer. 389067b3315SchristosIgnore any argument. 390067b3315SchristosCan be used as a movement command after 391067b3315Schristos.Ic vi_change_meta , 392067b3315Schristos.Ic vi_delete_meta , 393067b3315Schristosor 394067b3315Schristos.Ic vi_yank . 395067b3315Schristos.It Ic ed-newline Pq all modes: Ctrl-J, LF, Ctrl-M, CR 396067b3315SchristosAppend a newline character to the edit buffer and return the edit 397067b3315Schristosbuffer to the program. 398067b3315SchristosIgnore any argument. 399067b3315Schristos.It Ic ed-next-char Pq vi command: Space, l; emacs: Ctrl-F 400067b3315SchristosMove the cursor one character position to the right. 401067b3315SchristosWith an argument, move by that number of characters. 402067b3315SchristosCan be used as a movement command after 403067b3315Schristos.Ic vi_change_meta , 404067b3315Schristos.Ic vi_delete_meta , 405067b3315Schristosor 406067b3315Schristos.Ic vi_yank . 407067b3315SchristosIt is an error if the cursor is already at the end of the edit 408067b3315Schristosbuffer. 409067b3315Schristos.It Ic ed-next-history Pq vi command: j, +, Ctrl-N; emacs: Ctrl-N 410067b3315SchristosReplace the edit buffer with the next history line. 411f9ed317eSchristosThat line is older than the current line. 412067b3315SchristosWith an argument, go forward by that number of history lines. 413067b3315SchristosIt is a non-fatal error to advance by more lines than are available. 414067b3315Schristos.It Ic ed-next-line Pq not bound by default 415067b3315SchristosMove the cursor down one line. 416067b3315SchristosWith an argument, move down by that number of lines. 417067b3315SchristosIt is an error if the edit buffer does not contain enough newline 418067b3315Schristoscharacters to the right of the cursor position. 419067b3315Schristos.It Ic ed-prev-char Pq vi command: h; emacs: Ctrl-B 420067b3315SchristosMove the cursor one character position to the left. 421067b3315SchristosWith an argument, move by that number of characters. 422067b3315SchristosCan be used as a movement command after 423067b3315Schristos.Ic vi_change_meta , 424067b3315Schristos.Ic vi_delete_meta , 425067b3315Schristosor 426067b3315Schristos.Ic vi_yank . 427067b3315SchristosIt is an error if the cursor is already at the beginning of the 428067b3315Schristosedit buffer. 429067b3315Schristos.It Ic ed-prev-history Pq vi command: k, -, Ctrl-P; emacs: Ctrl-P 430067b3315SchristosReplace the edit buffer with the previous history line. 431f9ed317eSchristosThat line is newer than the current line. 432067b3315SchristosWith an argument, go back by that number of lines. 433067b3315SchristosIt is a non-fatal error to back up by more lines than are available. 434067b3315Schristos.It Ic ed-prev-line Pq not bound by default 435067b3315SchristosMove the cursor up one line. 436067b3315SchristosWith an argument, move up by that number of lines. 437067b3315SchristosIt is an error if the edit buffer does not contain enough newline 438067b3315Schristoscharacters to the left of the cursor position. 439067b3315Schristos.It Ic ed-prev-word Pq emacs: Meta-B, Meta-b 440067b3315SchristosMove the cursor to the left to the closest beginning of a word. 441067b3315SchristosWith an argument, repeat that number of times. 442067b3315SchristosCan be used as a movement command after 443067b3315Schristos.Ic vi_change_meta , 444067b3315Schristos.Ic vi_delete_meta , 445067b3315Schristosor 446067b3315Schristos.Ic vi_yank . 447067b3315SchristosIt is an error if the cursor is already at the beginning of the 448067b3315Schristosedit buffer. 449067b3315Schristos.It Ic ed-quoted-insert Pq vi insert, emacs: Ctrl-V 450067b3315SchristosRead one character from the terminal bypassing the normal line 451067b3315Schristosediting functionality and call 452067b3315Schristos.Ic ed-insert 453067b3315Schristoson it. 454067b3315SchristosIf trying to read the character returns end of file or an error, 455067b3315Schristoscall 456067b3315Schristos.Ic ed-end-of-file 457067b3315Schristosinstead. 458067b3315Schristos.It Ic ed-redisplay Pq vi command, emacs: Ctrl-R 459067b3315SchristosRedisplay everything. 460067b3315SchristosIgnore any argument. 461067b3315Schristos.It Ic ed-search-next-history Pq vi command: J; emacs: Meta-N, Meta-n 462067b3315SchristosReplace the edit buffer with the next matching history entry. 463067b3315Schristos.It Ic ed-search-prev-history Pq vi command: K; emacs: Meta-P, Meta-p 464067b3315SchristosReplace the edit buffer with the previous matching history entry. 465067b3315Schristos.It Ic ed-sequence-lead-in Pq vi cmd: O, \&[; emacs: Ctrl-X;\ 466067b3315Schristos both: Meta-O, Meta-[ 467067b3315SchristosCall a macro. 468067b3315SchristosSee the section about 469067b3315Schristos.Sx Macros 470067b3315Schristosbelow for details. 471067b3315Schristos.It Ic ed-start-over Pq not bound by default 472067b3315SchristosDiscard the contents of the edit buffer and start from scratch. 473067b3315SchristosIgnore any argument. 474067b3315Schristos.It Ic ed-transpose-chars Pq emacs: Ctrl-T 475067b3315SchristosExchange the character at the cursor position with the one to the 476067b3315Schristosleft of it and move the cursor to the character to the right of the 477067b3315Schristostwo exchanged characters. 478067b3315SchristosIgnore any argument. 479067b3315SchristosIt is an error if the cursor is at the beginning of the edit buffer 480067b3315Schristosor if the edit buffer contains less than two characters. 481067b3315Schristos.It Ic ed-unassigned Pq all characters not listed 482067b3315SchristosThis editor command always results in an error. 483067b3315Schristos.It Ic em-capitol-case Pq emacs: Meta-C, Meta-c 484067b3315SchristosCapitalize the string from the cursor to the end of the current 485067b3315Schristosword. 486067b3315SchristosThat is, if it contains at least one alphabetic character, convert 487067b3315Schristosthe first alphabetic character to upper case, and convert all 488067b3315Schristoscharacters to the right of it to lower case. 489067b3315SchristosIn any case, move the cursor to the next character after the end 490067b3315Schristosof the current word. 491067b3315Schristos.It Ic em-copy-prev-word Pq emacs: Ctrl-Meta-_ 492067b3315SchristosCopy the string from the beginning of the current word to the cursor 493067b3315Schristosand insert it to the left of the cursor. 494067b3315SchristosMove the cursor to the character after the inserted string. 495067b3315SchristosIt is an error if the cursor is at the beginning of the edit buffer. 496067b3315Schristos.It Ic em-copy-region Pq emacs: Meta-W, Meta-w 497067b3315SchristosCopy the string from the cursor to the mark to the cut buffer. 498067b3315SchristosIt is an error if the mark is not set. 499067b3315Schristos.It Ic em-delete-next-word Pq emacs: Meta-D, Meta-d 500067b3315SchristosDelete the string from the cursor to the end of the current word 501067b3315Schristosand save it to the cut buffer. 502067b3315SchristosIt is an error if the cursor is at the end of the edit buffer. 503067b3315Schristos.It Ic em-delete-or-list Pq emacs: Ctrl-D, EOF 504067b3315SchristosIf the cursor is not at the end of the line, delete the character 505067b3315Schristosat the cursor. 506067b3315SchristosIf the edit buffer is empty, indicate end of file to the program. 507067b3315SchristosIt is an error if the cursor is at the end of the edit buffer and 508067b3315Schristosthe edit buffer is not empty. 509067b3315Schristos.It Ic em-delete-prev-char Pq emacs: Ctrl-H, BS, Ctrl-?, DEL 510067b3315SchristosDelete the character to the left of the cursor. 511067b3315SchristosIt is an error if the cursor is at the beginning of the edit buffer. 512067b3315Schristos.It Ic em-exchange-mark Pq not bound by default 513067b3315SchristosExchange the cursor and the mark. 514067b3315Schristos.It Ic em-gosmacs-transpose Pq not bound by default 515067b3315SchristosExchange the two characters to the left of the cursor. 516067b3315SchristosIt is an error if the cursor is on the first or second character 517067b3315Schristosof the edit buffer. 518067b3315Schristos.It Ic em-inc-search-next Pq not bound by default 519067b3315SchristosEmacs incremental next search. 520067b3315Schristos.It Ic em-inc-search-prev Pq not bound by default 521067b3315SchristosEmacs incremental reverse search. 522067b3315Schristos.It Ic em-kill-line Pq not bound by default 523067b3315SchristosDelete the entire contents of the edit buffer and save it to the 524067b3315Schristoscut buffer. 525067b3315Schristos.It Ic em-kill-region Pq emacs: Ctrl-W 526067b3315SchristosDelete the string from the cursor to the mark and save it to the 527067b3315Schristoscut buffer. 528067b3315SchristosIt is an error if the mark is not set. 529067b3315Schristos.It Ic em-lower-case Pq emacs: Meta-L, Meta-l 530067b3315SchristosConvert the characters from the cursor to the end of the current 531067b3315Schristosword to lower case. 532067b3315Schristos.It Ic em-meta-next Pq vi command, emacs: Ctrl-[, ESC 533067b3315SchristosSet the bit 0x80 on the next character typed. 534067b3315SchristosUnless the resulting code point is printable, holding down the 535067b3315Schristos.Sq Meta- 536067b3315Schristoskey while typing that character is a simpler way to achieve the 537067b3315Schristossame effect. 538067b3315Schristos.It Ic em-next-word Pq Meta-F, Meta-f 539067b3315SchristosMove the cursor to the end of the current word. 540067b3315SchristosCan be used as a movement command after 541067b3315Schristos.Ic vi_change_meta , 542067b3315Schristos.Ic vi_delete_meta , 543067b3315Schristosor 544067b3315Schristos.Ic vi_yank . 545067b3315SchristosIt is an error if the cursor is already at the end of the edit 546067b3315Schristosbuffer. 547067b3315Schristos.It Ic em-set-mark Pq emacs: Ctrl-Q, NUL 548067b3315SchristosSet the mark at the current cursor position. 549*0c83befaSchristos.It Ic em-toggle-overwrite Pq insert 550067b3315SchristosSwitch from insert to overwrite mode or vice versa. 551067b3315Schristos.It Ic em-universal-argument Pq not bound by default 552067b3315SchristosIf in argument input mode, multiply the argument by 4. 553067b3315SchristosOtherwise, switch to argument input mode and set the argument to 4. 554067b3315SchristosIt is an error if the existing argument is already greater than a 555067b3315Schristosmillion. 556067b3315Schristos.It Ic em-upper-case Pq emacs: Meta-U, Meta-u 557067b3315SchristosConvert the characters from the cursor to the end of the current 558067b3315Schristosword to upper case. 559067b3315Schristos.It Ic em-yank Pq emacs: Ctrl-Y 560067b3315SchristosPaste the cut buffer to the left of the cursor. 561067b3315Schristos.It Ic vi-add Pq vi command: a 562067b3315SchristosSwitch to vi insert mode. 563067b3315SchristosUnless the cursor is already at the end of the edit buffer, move 564067b3315Schristosit one character position to the right. 565067b3315Schristos.It Ic vi-add-at-eol Pq vi command: A 566067b3315SchristosSwitch to vi insert mode and move the cursor to the end of the edit 567067b3315Schristosbuffer. 568067b3315Schristos.It Ic vi-alias Pq vi command: @ 569067b3315SchristosIf an alias function was defined by calling the 570067b3315Schristos.Xr el_set 3 571067b3315Schristosor 572067b3315Schristos.Xr el_wset 3 573067b3315Schristosfunction with the argument 574067b3315Schristos.Dv EL_ALIAS_TEXT , 575067b3315Schristosread one character from the terminal bypassing the normal line 576067b3315Schristosediting functionality, call the alias function passing the argument that was specified with 577067b3315Schristos.Dv EL_ALIAS_TEXT 578067b3315Schristosas the first argument and the character read, with an underscore 579067b3315Schristosprepended, as the second argument, and pass the string returned 580067b3315Schristosfrom the alias function to 581067b3315Schristos.Xr el_wpush 3 . 582067b3315SchristosIt is an error if no alias function is defined or if trying to read 583067b3315Schristosthe character results in end of file or an error. 584067b3315Schristos.It Ic vi-change-case Pq vi command: ~ 585067b3315SchristosChange the case of the character at the cursor and move the cursor 586067b3315Schristosone character position to the right. 587067b3315SchristosIt is an error if the cursor is already at the end of the edit 588067b3315Schristosbuffer. 589067b3315Schristos.It Ic vi-change-meta Pq vi command: c 590067b3315SchristosDelete the string from the cursor to the position specified by the 591067b3315Schristosfollowing movement command and save a copy of it to the cut buffer. 592067b3315SchristosWhen given twice in a row, instead delete the whole contents of the 593067b3315Schristosedit buffer and save a copy of it to the cut buffer. 594067b3315SchristosIn either case, switch to vi insert mode after that. 595067b3315Schristos.It Ic vi-change-to-eol Pq vi command: C 596067b3315SchristosDelete the string from the cursor position to the end of the line 597067b3315Schristosand save it to the cut buffer, then switch to vi insert mode. 598067b3315Schristos.It Ic vi-command-mode Pq vi insert: Ctrl-[, ESC 599067b3315SchristosDiscard pending actions and arguments and switch to vi command mode. 600067b3315SchristosUnless the cursor is already at the beginning of the edit buffer, 601067b3315Schristosmove it to the left by one character position. 602067b3315Schristos.It Ic vi-comment-out Pq vi command: # 603067b3315SchristosInsert a 604067b3315Schristos.Sq # 605067b3315Schristoscharacter at the beginning of the edit buffer and return the edit 606067b3315Schristosbuffer to the program. 607067b3315Schristos.It Ic vi-delete-meta Pq vi command: d 608067b3315SchristosDelete the string from the cursor to the position specified by the 609067b3315Schristosfollowing movement command and save a copy of it to the cut buffer. 610067b3315SchristosWhen given twice in a row, instead delete the whole contents of the 611067b3315Schristosedit buffer and save a copy of it to the cut buffer. 612067b3315Schristos.It Ic vi-delete-prev-char Pq vi insert: Ctrl-H, BS, Ctrl-?, DEL 613067b3315SchristosDelete the character to the left of the cursor. 614067b3315SchristosIt is an error if the cursor is already at the beginning of the 615067b3315Schristosedit buffer. 616067b3315Schristos.It Ic vi-end-big-word Pq vi command: E 617067b3315SchristosMove the cursor to the end of the current space delimited word. 618067b3315SchristosCan be used as a movement command after 619067b3315Schristos.Ic vi_change_meta , 620067b3315Schristos.Ic vi_delete_meta , 621067b3315Schristosor 622067b3315Schristos.Ic vi_yank . 623067b3315SchristosIt is an error if the cursor is already at the end of the edit 624067b3315Schristosbuffer. 625067b3315Schristos.It Ic vi-end-word Pq vi command: e 626067b3315SchristosMove the cursor to the end of the current word. 627067b3315SchristosCan be used as a movement command after 628067b3315Schristos.Ic vi_change_meta , 629067b3315Schristos.Ic vi_delete_meta , 630067b3315Schristosor 631067b3315Schristos.Ic vi_yank . 632067b3315SchristosIt is an error if the cursor is already at the end of the edit 633067b3315Schristosbuffer. 634067b3315Schristos.It Ic vi-history-word Pq vi command: _ 635067b3315SchristosInsert the first word from the most recent history entry after the 636067b3315Schristoscursor, move the cursor after to the character after the inserted 637067b3315Schristosword, and switch to vi insert mode. 638067b3315SchristosIt is an error if there is no history entry or the most recent 639067b3315Schristoshistory entry is empty. 640067b3315Schristos.It Ic vi-insert Pq vi command: i 641067b3315SchristosEnter insert mode. 642067b3315Schristos.It Ic vi-insert-at-bol Pq vi command: I 643067b3315SchristosMove the cursor to the beginning of the edit buffer and switch to 644067b3315Schristosvi insert mode. 645067b3315Schristos.It Ic vi-kill-line-prev Pq vi: Ctrl-U 646067b3315SchristosDelete the string from the beginning of the edit buffer to the 647067b3315Schristoscursor and save it to the cut buffer. 648067b3315Schristos.It Ic vi-list-or-eof Pq vi insert: Ctrl-D, EOF 649067b3315SchristosIf the edit buffer is empty, indicate end of file to the program. 650067b3315SchristosIt is an error if the edit buffer is not empty. 651067b3315Schristos.It Ic vi-match Pq vi command: % 652067b3315SchristosConsider opening and closing parentheses, braces, and brackets as 653067b3315Schristosdelimiters. 654067b3315SchristosIf the cursor is not at a delimiter, move it to the right until it 655067b3315Schristosgets to one, then move it to the matching delimiter. 656067b3315SchristosCan be used as a movement command after 657067b3315Schristos.Ic vi_change_meta , 658067b3315Schristos.Ic vi_delete_meta , 659067b3315Schristosor 660067b3315Schristos.Ic vi_yank . 661067b3315SchristosIt is an error if there is no delimiter at the cursor or in the 662067b3315Schristosstring to the right of the cursor, or if the first such delimiter 663067b3315Schristoshas no matching delimiter. 664067b3315Schristos.It Ic vi-next-big-word Pq vi command: W 665067b3315SchristosMove the cursor to the right to the beginning of the next space 666067b3315Schristosdelimited word. 667067b3315SchristosCan be used as a movement command after 668067b3315Schristos.Ic vi_change_meta , 669067b3315Schristos.Ic vi_delete_meta , 670067b3315Schristosor 671067b3315Schristos.Ic vi_yank . 672067b3315SchristosIt is an error if the cursor is already at the end of the edit 673067b3315Schristosbuffer or on its last character. 674067b3315Schristos.It Ic vi-next-char Pq vi command: f 675067b3315SchristosRead one character from the terminal bypassing the normal line 676067b3315Schristosediting functionality and move the cursor to the right to the next 677067b3315Schristosinstance of that character in the edit buffer. 678067b3315SchristosCan be used as a movement command after 679067b3315Schristos.Ic vi_change_meta , 680067b3315Schristos.Ic vi_delete_meta , 681067b3315Schristosor 682067b3315Schristos.Ic vi_yank . 683067b3315SchristosIf trying to read the character results in end of file or an error, 684067b3315Schristoscall 685067b3315Schristos.Ic ed-end-of-file 686067b3315Schristosinstead. 687067b3315SchristosIt is an error if the character is not found searching to the right 688067b3315Schristosin the edit buffer. 689067b3315Schristos.It Ic vi-next-word Pq vi command: w 690067b3315SchristosMove the cursor to the right to the beginning of the next word. 691067b3315SchristosCan be used as a movement command after 692067b3315Schristos.Ic vi_change_meta , 693067b3315Schristos.Ic vi_delete_meta , 694067b3315Schristosor 695067b3315Schristos.Ic vi_yank . 696067b3315SchristosIt is an error if the cursor is already at the end of the edit 697067b3315Schristosbuffer or on its last character. 698067b3315Schristos.It Ic vi-paste-next Pq vi command: p 699067b3315SchristosInsert a copy of the cut buffer to the right of the cursor. 700067b3315SchristosIt is an error if the cut buffer is empty. 701067b3315Schristos.It Ic vi-paste-prev Pq vi command: P 702067b3315SchristosInsert a copy of the cut buffer to the left of the cursor. 703067b3315SchristosIt is an error if the cut buffer is empty. 704067b3315Schristos.It Ic vi-prev-big-word Pq vi command: B 705067b3315SchristosMove the cursor to the left to the next beginning of a space delimited 706067b3315Schristosword. 707067b3315SchristosCan be used as a movement command after 708067b3315Schristos.Ic vi_change_meta , 709067b3315Schristos.Ic vi_delete_meta , 710067b3315Schristosor 711067b3315Schristos.Ic vi_yank . 712067b3315SchristosIt is an error if the cursor is already at the beginning of the 713067b3315Schristosedit buffer. 714067b3315Schristos.It Ic vi-prev-char Pq vi command: F 715067b3315SchristosRead one character from the terminal bypassing the normal line 716067b3315Schristosediting functionality and move the cursor to the left to the next 717067b3315Schristosinstance of that character in the edit buffer. 718067b3315SchristosCan be used as a movement command after 719067b3315Schristos.Ic vi_change_meta , 720067b3315Schristos.Ic vi_delete_meta , 721067b3315Schristosor 722067b3315Schristos.Ic vi_yank . 723067b3315SchristosIf trying to read the character results in end of file or an error, 724067b3315Schristoscall 725067b3315Schristos.Ic ed-end-of-file 726067b3315Schristosinstead. 727067b3315SchristosIt is an error if the character is not found searching to the left 728067b3315Schristosin the edit buffer. 729067b3315Schristos.It Ic vi-prev-word Pq vi command: b 730067b3315SchristosMove the cursor to the left to the next beginning of a word. 731067b3315SchristosCan be used as a movement command after 732067b3315Schristos.Ic vi_change_meta , 733067b3315Schristos.Ic vi_delete_meta , 734067b3315Schristosor 735067b3315Schristos.Ic vi_yank . 736067b3315SchristosIt is an error if the cursor is already at the beginning of the 737067b3315Schristosedit buffer. 738067b3315Schristos.It Ic vi-redo Pq vi command: Sq \&. 739067b3315SchristosRedo the last non-motion command. 740067b3315Schristos.It Ic vi-repeat-next-char Pq vi command: Sq \&; 741067b3315SchristosRepeat the most recent character search in the same search direction. 742067b3315SchristosCan be used as a movement command after 743067b3315Schristos.Ic vi_change_meta , 744067b3315Schristos.Ic vi_delete_meta , 745067b3315Schristosor 746067b3315Schristos.Ic vi_yank . 747067b3315Schristos.It Ic vi-repeat-prev-char Pq vi command: Sq \&, 748067b3315SchristosRepeat the most recent character search in the opposite search 749067b3315Schristosdirection. 750067b3315SchristosCan be used as a movement command after 751067b3315Schristos.Ic vi_change_meta , 752067b3315Schristos.Ic vi_delete_meta , 753067b3315Schristosor 754067b3315Schristos.Ic vi_yank . 755067b3315Schristos.It Ic vi-repeat-search-next Pq vi command: n 756067b3315SchristosRepeat the most recent history search in the same search direction. 757067b3315Schristos.It Ic vi-repeat-search-prev Pq vi command: N 758067b3315SchristosRepeat the most recent history search in the opposite search 759067b3315Schristosdirection. 760067b3315Schristos.It Ic vi-replace-char Pq vi command: r 761067b3315SchristosSwitch to vi replace mode, and automatically switch back to vi 762067b3315Schristoscommand mode after the next character typed. 763067b3315SchristosSee 764067b3315Schristos.Ic ed-insert 765067b3315Schristosfor a description of replace mode. 766067b3315SchristosIt is an error if the cursor is at the end of the edit buffer. 767067b3315Schristos.It Ic vi-replace-mode Pq vi command: R 768067b3315SchristosSwitch to vi replace mode. 769067b3315SchristosThis is a variant of vi insert mode; see 770067b3315Schristos.Ic ed-insert 771067b3315Schristosfor the difference. 772067b3315Schristos.It Ic vi-search-next Pq vi command: \&? 773067b3315SchristosReplace the edit buffer with the next matching history entry. 774067b3315Schristos.It Ic vi-search-prev Pq vi command: / 775067b3315SchristosReplace the edit buffer with the previous matching history entry. 776067b3315Schristos.It Ic vi-substitute-char Pq vi command: s 777067b3315SchristosDelete the character at the cursor and switch to vi insert mode. 778067b3315Schristos.It Ic vi-substitute-line Pq vi command: S 779067b3315SchristosDelete the entire contents of the edit buffer, save a copy of it 780067b3315Schristosin the cut buffer, and enter vi insert mode. 781067b3315Schristos.It Ic vi-to-column Pq vi command: \&| 782067b3315SchristosMove the cursor to the column specified as the argument. 783067b3315SchristosCan be used as a movement command after 784067b3315Schristos.Ic vi_change_meta , 785067b3315Schristos.Ic vi_delete_meta , 786067b3315Schristosor 787067b3315Schristos.Ic vi_yank . 788067b3315Schristos.It Ic vi-to-history-line Pq vi command: G 789067b3315SchristosReplace the edit buffer with the specified history entry. 790067b3315Schristos.It Ic vi-to-next-char Pq vi command: t 791067b3315SchristosRead one character from the terminal bypassing the normal line 792067b3315Schristosediting functionality and move the cursor to the right to the 793067b3315Schristoscharacter before the next instance of that character in the edit 794067b3315Schristosbuffer. 795067b3315SchristosCan be used as a movement command after 796067b3315Schristos.Ic vi_change_meta , 797067b3315Schristos.Ic vi_delete_meta , 798067b3315Schristosor 799067b3315Schristos.Ic vi_yank . 800067b3315SchristosIf trying to read the character results in end of file or an error, 801067b3315Schristoscall 802067b3315Schristos.Ic ed-end-of-file 803067b3315Schristosinstead. 804067b3315SchristosIt is an error if the character is not found searching to the right 805067b3315Schristosin the edit buffer. 806067b3315Schristos.It Ic vi-to-prev-char Pq vi command: T 807067b3315SchristosRead one character from the terminal bypassing the normal line 808067b3315Schristosediting functionality and move the cursor to the left to the character 809067b3315Schristosafter the next instance of that character in the edit buffer. 810067b3315SchristosCan be used as a movement command after 811067b3315Schristos.Ic vi_change_meta , 812067b3315Schristos.Ic vi_delete_meta , 813067b3315Schristosor 814067b3315Schristos.Ic vi_yank . 815067b3315SchristosIf trying to read the character results in end of file or an error, 816067b3315Schristoscall 817067b3315Schristos.Ic ed-end-of-file 818067b3315Schristosinstead. 819067b3315SchristosIt is an error if the character is not found searching to the left 820067b3315Schristosin the edit buffer. 821067b3315Schristos.It Ic vi-undo Pq vi command: u 822067b3315SchristosUndo the last change. 823067b3315Schristos.It Ic vi-undo-line Pq vi command: U 824067b3315SchristosUndo all changes to the edit buffer. 825067b3315Schristos.It Ic vi-yank Pq vi command: y 826067b3315SchristosCopy the string from the cursor to the position specified by the 827067b3315Schristosfollowing movement command to the cut buffer. 828067b3315SchristosWhen given twice in a row, instead copy the whole contents of the 829067b3315Schristosedit buffer to the cut buffer. 830067b3315Schristos.It Ic vi-yank-end Pq vi command: Y 831067b3315SchristosCopy the string from the cursor to the end of the edit buffer to 832067b3315Schristosthe cut buffer. 833067b3315Schristos.It Ic vi-zero Pq vi command: 0 834067b3315SchristosIf in argument input mode, multiply the argument by ten. 835067b3315SchristosOtherwise, move the cursor to the beginning of the edit buffer. 836067b3315SchristosCan be used as a movement command after 837067b3315Schristos.Ic vi_change_meta , 838067b3315Schristos.Ic vi_delete_meta , 839067b3315Schristosor 840067b3315Schristos.Ic vi_yank . 841067b3315Schristos.El 842067b3315Schristos.Ss Macros 843067b3315SchristosIf an input character is bound to the editor command 844067b3315Schristos.Ic ed-sequence-lead-in , 845067b3315Schristos.Nm 846067b3315Schristosattempts to call a macro. 847067b3315SchristosIf the input character by itself forms the name of a macro, that 848067b3315Schristosmacro is executed. 849067b3315SchristosOtherwise, additional input characters are read until the string 850067b3315Schristosread forms the name of a macro, in which case that macro is executed, 851067b3315Schristosor until the string read matches the beginning of none of the existing 852067b3315Schristosmacro names, in which case the string including the final, mismatching 853067b3315Schristoscharacter is discarded and the terminal bell is rung. 854067b3315Schristos.Pp 855067b3315SchristosThere are two kinds of macros. 856067b3315SchristosCommand macros execute a single editor command. 857067b3315SchristosKeyboard macros return a string of characters that is appended 858067b3315Schristosas a new line to the 859067b3315Schristos.Sx Input Queue . 860067b3315Schristos.Pp 861067b3315SchristosThe following command macros are defined by default in vi command 862067b3315Schristosmode and in emacs mode: 863067b3315Schristos.Bl -column -offset indent "Esc O A, Esc O A" "em-exchange-mark" 864067b3315Schristos.It Esc \&[ A, Esc O A Ta Ic ed-prev-history 865067b3315Schristos.It Esc \&[ B, Esc O B Ta Ic ed-next-history 866067b3315Schristos.It Esc \&[ C, Esc O C Ta Ic ed-next-char 867067b3315Schristos.It Esc \&[ D, Esc O D Ta Ic ed-prev-char 868067b3315Schristos.It Esc \&[ F, Esc O F Ta Ic ed-move-to-end 869067b3315Schristos.It Esc \&[ H, Esc O H Ta Ic ed-move-to-beg 870067b3315Schristos.El 871067b3315Schristos.Pp 872067b3315SchristosIn vi command mode, they are also defined by default without the 873067b3315Schristosinitial escape character. 874067b3315Schristos.Pp 875067b3315SchristosIn addition, the 876067b3315Schristos.Nm 877067b3315Schristoslibrary tries to bind the strings generated by the arrow keys 878067b3315Schristosas reported by the 879067b3315Schristos.Xr terminfo 5 880067b3315Schristosdatabase to these editor commands, unless that would clobber 881067b3315Schristosuser settings. 882067b3315Schristos.Pp 883067b3315SchristosIn emacs mode, the two-character string 884067b3315Schristos.Dq Ctrl-X Ctrl-X 885067b3315Schristosis bound to the 886067b3315Schristos.Ic em-exchange-mark 887067b3315Schristoseditor command. 888067b3315Schristos.Ss Input Queue 889067b3315SchristosThe 890067b3315Schristos.Nm 891067b3315Schristoslibrary maintains an input queue operated in FIFO mode. 892067b3315SchristosWhenever it needs an input character, it takes the first character 893067b3315Schristosfrom the first line of the input queue. 894067b3315SchristosWhen the queue is empty, it reads from the terminal. 895067b3315Schristos.Pp 896067b3315SchristosA line can be appended to the end of the input queue in several ways: 897067b3315Schristos.Bl -dash -offset indent 898067b3315Schristos.It 899067b3315SchristosBy calling one of the keyboard 900067b3315Schristos.Sx Macros . 901067b3315Schristos.It 902067b3315SchristosBy calling the editor command 903067b3315Schristos.Ic vi-redo . 904067b3315Schristos.It 905067b3315SchristosBy calling the editor command 906067b3315Schristos.Ic vi-alias . 907067b3315Schristos.It 908067b3315SchristosBy pressing a key in emacs incremental search mode that doesn't 909067b3315Schristoshave a special meaning in that mode but returns to normal emacs 910067b3315Schristosmode. 911067b3315Schristos.It 912067b3315SchristosIf an application program directly calls the functions 913067b3315Schristos.Xr el_push 3 914067b3315Schristosor 915067b3315Schristos.Xr el_wpush 3 , 916067b3315Schristosit can provide additional, program-specific ways 917067b3315Schristosof appending to the input queue. 918067b3315Schristos.El 919067b3315Schristos.Sh SEE ALSO 920067b3315Schristos.Xr mg 1 , 921067b3315Schristos.Xr vi 1 , 922067b3315Schristos.Xr editline 3 , 923ac44c4d1Schristos.Xr el_wgets 3 , 924ac44c4d1Schristos.Xr el_wpush 3 , 925ac44c4d1Schristos.Xr el_wset 3 , 926067b3315Schristos.Xr editrc 5 927067b3315Schristos.Sh HISTORY 928067b3315SchristosThis manual page first appeared in 929067b3315Schristos.Ox 6.0 930067b3315Schristosand 931067b3315Schristos.Nx 8 . 932067b3315Schristos.Sh AUTHORS 933067b3315Schristos.An -nosplit 934067b3315SchristosThis manual page was written by 935067b3315Schristos.An Ingo Schwarze Aq Mt schwarze@openbsd.org . 936