{
    "content": [
        {
            "type": "text",
            "text": "# editline(7edit) (man)\n\n**Summary:** editline — line editing user interface\n\n## See Also\n\n- mg(1)\n- vi(1)\n- elwgets(3)\n- elwpush(3)\n- elwset(3)\n- editrc(5edit)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (13 lines) — 4 subsections\n  - Input character bindings (187 lines)\n  - Editor commands (435 lines)\n  - Macros (28 lines)\n  - Input Queue (18 lines)\n- **SEE ALSO** (2 lines)\n- **HISTORY** (2 lines)\n- **AUTHORS** (3 lines)\n\n## Full Content\n\n### NAME\n\neditline — line editing user interface\n\n### DESCRIPTION\n\nWhen a program using the editline(3edit) library prompts for an input string using the function\nelwgets(3), it reads characters from the terminal.  Invalid input bytes that do not form char‐\nacters are silently discarded.  For each character read, one editor command is executed.  The\nmapping of input characters to editor commands depends on the editing mode.  There are three\nediting modes: vi insert mode, vi command mode, and emacs mode.  The default is vi insert mode.\nThe program can switch the default to emacs mode by using the elset(3) or elparse(3) func‐\ntions, and the user can switch to emacs mode either in the editrc(5edit) configuration file or\ninteractively with the ed-command editor command, in all three cases executing the bind -e\nbuiltin command.\n\nIf trying to read from the terminal results in end of file or an error, the library signals end\nof file to the program and does not return a string.\n\n#### Input character bindings\n\nAll default bindings described below can be overridden by individual programs and can be\nchanged with the editrc(5edit) bind builtin command.\n\nIn the following tables, ‘Ctrl-’ indicates a character with the bit 0x40 flipped, and ‘Meta-’\nindicates a character with the bit 0x80 set.  In vi insert mode and in emacs mode, all Meta-\ncharacters considered printable by the current locale(1) are bound to ed-insert instead of to\nthe editor command listed below.  Consequently, in UTF-8 mode, most of the Meta-characters are\nnot directly accessible because their code points are occupied by printable Unicode characters,\nand Meta-characters are usually input using the em-meta-next editor command.  For example, to\nenter ‘Meta-B’ in order to call the ed-prev-word editor command in emacs mode, call\nem-meta-next by pressing and releasing the escape key (or equivalently, Ctrl-[), then press and\nrelease the ‘B’ key.  If you have configured a Meta-key on your keyboard, for example with\n‘setxkbmap -option altwin:leftmetawin’, the Ctrl-Meta-characters are directly accessible.\nFor example, to enter ‘Ctrl-Meta-H’ in order to call the ed-delete-prev-word editor command in\nemacs mode, hold down the keys ‘Ctrl’, ‘Meta’, and ‘H’ at the same time.  Alternatively, press\nand release the escape key, then press and release ‘Ctrl-H’.\n\nIn vi input mode, input characters are bound to the following editor commands by default:\n\nCtrl-D, EOF     vi-list-or-eof\nCtrl-H, BS      vi-delete-prev-char\nCtrl-J, LF      ed-newline\nCtrl-M, CR      ed-newline\nCtrl-Q          ed-tty-start-output\nCtrl-S          ed-tty-stop-output\nCtrl-U          vi-kill-line-prev\nCtrl-V          ed-quoted-insert\nCtrl-W          ed-delete-prev-word\nCtrl-[, ESC     vi-command-mode\nCtrl-\\, QUIT    ed-tty-sigquit\nCtrl-?, DEL     vi-delete-prev-char\n\nAll other input characters except the NUL character (Ctrl-@) are bound to ed-insert.\n\nIn vi command mode, input characters are bound to the following editor commands by default:\n\nCtrl-A          ed-move-to-beg\nCtrl-C, INT     ed-tty-sigint\nCtrl-E          ed-move-to-end\nCtrl-H, BS      ed-delete-prev-char\nCtrl-J, LF      ed-newline\nCtrl-K          ed-kill-line\nCtrl-L, FF      ed-clear-screen\nCtrl-M, CR      ed-newline\nCtrl-N          ed-next-history\nCtrl-O          ed-tty-flush-output\nCtrl-P          ed-prev-history\nCtrl-Q          ed-tty-start-output\nCtrl-R          ed-redisplay\nCtrl-S          ed-tty-stop-output\nCtrl-U          vi-kill-line-prev\nCtrl-W          ed-delete-prev-word\nCtrl-[, ESC     em-meta-next\nCtrl-\\, QUIT    ed-tty-sigquit\nSpace           ed-next-char\n#               vi-comment-out\n$               ed-move-to-end\n%               vi-match\n+               ed-next-history\n,               vi-repeat-prev-char\n-               ed-prev-history\n.               vi-redo\n/               vi-search-prev\n0               vi-zero\n1 to 9          ed-argument-digit\n:               ed-command\n;               vi-repeat-next-char\n?               vi-search-next\n@               vi-alias\nA               vi-add-at-eol\nB               vi-prev-big-word\nC               vi-change-to-eol\nD               ed-kill-line\nE               vi-end-big-word\nF               vi-prev-char\nG               vi-to-history-line\nI               vi-insert-at-bol\nJ               ed-search-next-history\nK               ed-search-prev-history\nN               vi-repeat-search-prev\nO               ed-sequence-lead-in\nP               vi-paste-prev\nR               vi-replace-mode\nS               vi-substitute-line\nT               vi-to-prev-char\nU               vi-undo-line\nW               vi-next-big-word\nX               ed-delete-prev-char\nY               vi-yank-end\n[               ed-sequence-lead-in\n^               ed-move-to-beg\nvi-history-word\na               vi-add\nb               vi-prev-word\nc               vi-change-meta\nd               vi-delete-meta\ne               vi-end-word\nf               vi-next-char\nh               ed-prev-char\ni               vi-insert\nj               ed-next-history\nk               ed-prev-history\nl               ed-next-char\nn               vi-repeat-search-next\np               vi-paste-next\nr               vi-replace-char\ns               vi-substitute-char\nt               vi-to-next-char\nu               vi-undo\nv               vi-histedit\nw               vi-next-word\nx               ed-delete-next-char\ny               vi-yank\n|               vi-to-column\n~               vi-change-case\nCtrl-?, DEL     ed-delete-prev-char\nMeta-O          ed-sequence-lead-in\nMeta-[          ed-sequence-lead-in\n\nIn emacs mode, input characters are bound to the following editor commands by default:\n\n0 to 9          ed-digit\nCtrl-@, NUL     em-set-mark\nCtrl-A          ed-move-to-beg\nCtrl-B          ed-prev-char\nCtrl-C, INT     ed-tty-sigint\nCtrl-D, EOF     em-delete-or-list\nCtrl-E          ed-move-to-end\nCtrl-F          ed-next-char\nCtrl-H, BS      em-delete-prev-char\nCtrl-J, LF      ed-newline\nCtrl-K          ed-kill-line\nCtrl-L, FF      ed-clear-screen\nCtrl-M, CR      ed-newline\nCtrl-N          ed-next-history\nCtrl-O          ed-tty-flush-output\nCtrl-P          ed-prev-history\nCtrl-Q          ed-tty-start-output\nCtrl-R          ed-redisplay\nCtrl-S          ed-tty-stop-output\nCtrl-T          ed-transpose-chars\nCtrl-U          ed-kill-line\nCtrl-V          ed-quoted-insert\nCtrl-W          em-kill-region\nCtrl-X          ed-sequence-lead-in\nCtrl-Y          em-yank\nCtrl-Z, TSTP    ed-tty-sigtstp\nCtrl-[, ESC     em-meta-next\nCtrl-\\, QUIT    ed-tty-sigquit\nCtrl-]          ed-tty-dsusp\nCtrl-?, DEL     em-delete-prev-char\nCtrl-Meta-H     ed-delete-prev-word\nCtrl-Meta-L     ed-clear-screen\nCtrl-Meta-     em-copy-prev-word\nMeta-0 to 9     ed-argument-digit\nMeta-B          ed-prev-word\nMeta-C          em-capitol-case\nMeta-D          em-delete-next-word\nMeta-F          em-next-word\nMeta-L          em-lower-case\nMeta-N          ed-search-next-history\nMeta-O          ed-sequence-lead-in\nMeta-P          ed-search-prev-history\nMeta-U          em-upper-case\nMeta-W          em-copy-region\nMeta-X          ed-command\nMeta-[          ed-sequence-lead-in\nMeta-b          ed-prev-word\nMeta-c          em-capitol-case\nMeta-d          em-delete-next-word\nMeta-f          em-next-word\nMeta-l          em-lower-case\nMeta-n          ed-search-next-history\nMeta-p          ed-search-prev-history\nMeta-u          em-upper-case\nMeta-w          em-copy-region\nMeta-x          ed-command\nCtrl-Meta-?     ed-delete-prev-word\n\nThe remaining ascii(7) characters in the range 0x20 to 0x7e are bound to ed-insert.\n\nIf standard output is not connected to a terminal device or elset(3) was used to set\nELEDITMODE to 0, all input character bindings are disabled and all characters typed are ap‐\npended to the edit buffer.  In that case, the edit buffer is returned to the program after a\nnewline or carriage return character is typed, or after the first character typed if elset(3)\nwas used to set ELUNBUFFERED to non-zero.\n\n#### Editor commands\n\nMost editor commands accept an optional argument.  The argument is entered by prefixing the ed‐\nitor command with one or more of the editor commands ed-argument-digit, ed-digit,\nem-universal-argument, or vi-zero.  When an argument is not provided, it defaults to 1.  For\nmost editor commands, the effect of an argument is to repeatedly execute the command that num‐\nber of times.\n\nWhen talking about a character string from a left character to a right character, the left\ncharacter is included in the string, while the right character is not included.\n\nIf an editor command causes an error, the input character is discarded, no action occurs, and\nthe terminal bell is rung.  In case of a non-fatal error, the terminal bell is also rung, but\nthe editor command takes effect anyway.\n\nIn the following list, the default key bindings are listed after each editor command.\n\ned-argument-digit (vi command: 1 to 9; emacs: Meta-0 to Meta-9)\nIf in argument input mode, append the input digit to the argument being read.  Otherwise,\nswitch to argument input mode and use the input digit as the most significant digit of\nthe argument.  It is an error if the input character is not a digit or if the existing\nargument is already greater than a million.\n\ned-clear-screen (vi command: Ctrl-L; emacs: Ctrl-L, Ctrl-Meta-L)\nClear the screen and display the edit buffer at the top.  Ignore any argument.\n\ned-command (vi command: ‘:’; emacs: Meta-X, Meta-x)\nRead a line from the terminal bypassing the normal line editing functionality and execute\nthat line as an editrc(5edit) builtin command.  If in vi command mode, also switch back\nto vi insert mode.  Ignore any argument.\n\ned-delete-next-char (vi command: x)\nDelete the character at the cursor position.  With an argument, delete that number of\ncharacters.  In emacs mode, it is an error if the cursor is at the end of the edit buf‐\nfer.  In vi mode, the last character in the edit buffer is deleted in that case, and it\nis an error if the buffer is empty.\n\ned-delete-prev-char (vi command: X, Ctrl-H, BS, Ctrl-?, DEL)\nDelete the character to the left of the cursor position.  With an argument, delete that\nnumber of characters.  It is an error if the cursor is at the beginning of the edit buf‐\nfer.\n\ned-delete-prev-word (vi: Ctrl-W; emacs: Ctrl-Meta-H, Ctrl-Meta-?)\nMove to the left to the closest beginning of a word, delete the string from that position\nto the cursor, and save it to the cut buffer.  With an argument, delete that number of\nwords.  It is an error if the cursor is at the beginning of the edit buffer.\n\ned-digit (emacs: 0 to 9)\nIf in argument input mode, append the input digit to the argument being read.  Otherwise,\ncall ed-insert.  It is an error if the input character is not a digit or if the existing\nargument is already greater than a million.\n\ned-end-of-file (not bound by default)\nDiscard the edit buffer and indicate end of file to the program.  Ignore any argument.\n\ned-ignore (various)\nDiscard the input character and do nothing.\n\ned-insert (vi input: almost all; emacs: printable characters)\nIn insert mode, insert the input character left of the cursor position.  In replace mode,\noverwrite the character at the cursor and move the cursor to the right by one character\nposition.  Accept an argument to do this repeatedly.  It is an error if the input charac‐\nter is the NUL character (Ctrl-@).  Failure to enlarge the edit buffer also results in an\nerror.\n\ned-kill-line (vi command: D, Ctrl-K; emacs: Ctrl-K, Ctrl-U)\nDelete the string from the cursor position to the end of the line and save it to the cut\nbuffer.  Ignore any argument.\n\ned-move-to-beg (vi command: ^, Ctrl-A; emacs: Ctrl-A)\nIn vi mode, move the cursor to the first non-space character in the edit buffer.  In\nemacs mode, move the cursor to the beginning of the edit buffer.  Ignore any argument.\nCan be used as a movement command after vichangemeta, videletemeta, or viyank.\n\ned-move-to-end (vi command: $, Ctrl-E; emacs: Ctrl-E)\nMove the cursor to the end of the edit buffer.  Ignore any argument.  Can be used as a\nmovement command after vichangemeta, videletemeta, or viyank.\n\ned-newline (all modes: Ctrl-J, LF, Ctrl-M, CR)\nAppend a newline character to the edit buffer and return the edit buffer to the program.\nIgnore any argument.\n\ned-next-char (vi command: Space, l; emacs: Ctrl-F)\nMove the cursor one character position to the right.  With an argument, move by that num‐\nber of characters.  Can be used as a movement command after vichangemeta,\nvideletemeta, or viyank.  It is an error if the cursor is already at the end of the\nedit buffer.\n\ned-next-history (vi command: j, +, Ctrl-N; emacs: Ctrl-N)\nReplace the edit buffer with the next history line.  That line is older than the current\nline.  With an argument, go forward by that number of history lines.  It is a non-fatal\nerror to advance by more lines than are available.\n\ned-next-line (not bound by default)\nMove the cursor down one line.  With an argument, move down by that number of lines.  It\nis an error if the edit buffer does not contain enough newline characters to the right of\nthe cursor position.\n\ned-prev-char (vi command: h; emacs: Ctrl-B)\nMove the cursor one character position to the left.  With an argument, move by that num‐\nber of characters.  Can be used as a movement command after vichangemeta,\nvideletemeta, or viyank.  It is an error if the cursor is already at the beginning of\nthe edit buffer.\n\ned-prev-history (vi command: k, -, Ctrl-P; emacs: Ctrl-P)\nReplace the edit buffer with the previous history line.  That line is newer than the cur‐\nrent line.  With an argument, go back by that number of lines.  It is a non-fatal error\nto back up by more lines than are available.\n\ned-prev-line (not bound by default)\nMove the cursor up one line.  With an argument, move up by that number of lines.  It is\nan error if the edit buffer does not contain enough newline characters to the left of the\ncursor position.\n\ned-prev-word (emacs: Meta-B, Meta-b)\nMove the cursor to the left to the closest beginning of a word.  With an argument, repeat\nthat number of times.  Can be used as a movement command after vichangemeta,\nvideletemeta, or viyank.  It is an error if the cursor is already at the beginning of\nthe edit buffer.\n\ned-quoted-insert (vi insert, emacs: Ctrl-V)\nRead one character from the terminal bypassing the normal line editing functionality and\ncall ed-insert on it.  If trying to read the character returns end of file or an error,\ncall ed-end-of-file instead.\n\ned-redisplay (vi command, emacs: Ctrl-R)\nRedisplay everything.  Ignore any argument.\n\ned-search-next-history (vi command: J; emacs: Meta-N, Meta-n)\nReplace the edit buffer with the next matching history entry.\n\ned-search-prev-history (vi command: K; emacs: Meta-P, Meta-p)\nReplace the edit buffer with the previous matching history entry.\n\ned-sequence-lead-in (vi cmd: O, [; emacs: Ctrl-X; both: Meta-O, Meta-[)\nCall a macro.  See the section about Macros below for details.\n\ned-start-over (not bound by default)\nDiscard the contents of the edit buffer and start from scratch.  Ignore any argument.\n\ned-transpose-chars (emacs: Ctrl-T)\nExchange the character at the cursor position with the one to the left of it and move the\ncursor to the character to the right of the two exchanged characters.  Ignore any argu‐\nment.  It is an error if the cursor is at the beginning of the edit buffer or if the edit\nbuffer contains less than two characters.\n\ned-unassigned (all characters not listed)\nThis editor command always results in an error.\n\nem-capitol-case (emacs: Meta-C, Meta-c)\nCapitalize the string from the cursor to the end of the current word.  That is, if it\ncontains at least one alphabetic character, convert the first alphabetic character to up‐\nper case, and convert all characters to the right of it to lower case.  In any case, move\nthe cursor to the next character after the end of the current word.\n\nem-copy-prev-word (emacs: Ctrl-Meta-)\nCopy the string from the beginning of the current word to the cursor and insert it to the\nleft of the cursor.  Move the cursor to the character after the inserted string.  It is\nan error if the cursor is at the beginning of the edit buffer.\n\nem-copy-region (emacs: Meta-W, Meta-w)\nCopy the string from the cursor to the mark to the cut buffer.  It is an error if the\nmark is not set.\n\nem-delete-next-word (emacs: Meta-D, Meta-d)\nDelete the string from the cursor to the end of the current word and save it to the cut\nbuffer.  It is an error if the cursor is at the end of the edit buffer.\n\nem-delete-or-list (emacs: Ctrl-D, EOF)\nIf the cursor is not at the end of the line, delete the character at the cursor.  If the\nedit buffer is empty, indicate end of file to the program.  It is an error if the cursor\nis at the end of the edit buffer and the edit buffer is not empty.\n\nem-delete-prev-char (emacs: Ctrl-H, BS, Ctrl-?, DEL)\nDelete the character to the left of the cursor.  It is an error if the cursor is at the\nbeginning of the edit buffer.\n\nem-exchange-mark (not bound by default)\nExchange the cursor and the mark.\n\nem-gosmacs-transpose (not bound by default)\nExchange the two characters to the left of the cursor.  It is an error if the cursor is\non the first or second character of the edit buffer.\n\nem-inc-search-next (not bound by default)\nEmacs incremental next search.\n\nem-inc-search-prev (not bound by default)\nEmacs incremental reverse search.\n\nem-kill-line (not bound by default)\nDelete the entire contents of the edit buffer and save it to the cut buffer.\n\nem-kill-region (emacs: Ctrl-W)\nDelete the string from the cursor to the mark and save it to the cut buffer.  It is an\nerror if the mark is not set.\n\nem-lower-case (emacs: Meta-L, Meta-l)\nConvert the characters from the cursor to the end of the current word to lower case.\n\nem-meta-next (vi command, emacs: Ctrl-[, ESC)\nSet the bit 0x80 on the next character typed.  Unless the resulting code point is print‐\nable, holding down the ‘Meta-’ key while typing that character is a simpler way to\nachieve the same effect.\n\nem-next-word (Meta-F, Meta-f)\nMove the cursor to the end of the current word.  Can be used as a movement command after\nvichangemeta, videletemeta, or viyank.  It is an error if the cursor is already at\nthe end of the edit buffer.\n\nem-set-mark (emacs: Ctrl-Q, NUL)\nSet the mark at the current cursor position.\n\nem-toggle-overwrite (not bound by default)\nSwitch from insert to overwrite mode or vice versa.\n\nem-universal-argument (not bound by default)\nIf in argument input mode, multiply the argument by 4.  Otherwise, switch to argument in‐\nput mode and set the argument to 4.  It is an error if the existing argument is already\ngreater than a million.\n\nem-upper-case (emacs: Meta-U, Meta-u)\nConvert the characters from the cursor to the end of the current word to upper case.\n\nem-yank (emacs: Ctrl-Y)\nPaste the cut buffer to the left of the cursor.\n\nvi-add (vi command: a)\nSwitch to vi insert mode.  Unless the cursor is already at the end of the edit buffer,\nmove it one character position to the right.\n\nvi-add-at-eol (vi command: A)\nSwitch to vi insert mode and move the cursor to the end of the edit buffer.\n\nvi-alias (vi command: @)\nIf an alias function was defined by calling the elset(3) or elwset(3) function with the\nargument ELALIASTEXT, read one character from the terminal bypassing the normal line\nediting functionality, call the alias function passing the argument that was specified\nwith ELALIASTEXT as the first argument and the character read, with an underscore\nprepended, as the second argument, and pass the string returned from the alias function\nto elwpush(3).  It is an error if no alias function is defined or if trying to read the\ncharacter results in end of file or an error.\n\nvi-change-case (vi command: ~)\nChange the case of the character at the cursor and move the cursor one character position\nto the right.  It is an error if the cursor is already at the end of the edit buffer.\n\nvi-change-meta (vi command: c)\nDelete the string from the cursor to the position specified by the following movement\ncommand and save a copy of it to the cut buffer.  When given twice in a row, instead\ndelete the whole contents of the edit buffer and save a copy of it to the cut buffer.  In\neither case, switch to vi insert mode after that.\n\nvi-change-to-eol (vi command: C)\nDelete the string from the cursor position to the end of the line and save it to the cut\nbuffer, then switch to vi insert mode.\n\nvi-command-mode (vi insert: Ctrl-[, ESC)\nDiscard pending actions and arguments and switch to vi command mode.  Unless the cursor\nis already at the beginning of the edit buffer, move it to the left by one character po‐\nsition.\n\nvi-comment-out (vi command: #)\nInsert a ‘#’ character at the beginning of the edit buffer and return the edit buffer to\nthe program.\n\nvi-delete-meta (vi command: d)\nDelete the string from the cursor to the position specified by the following movement\ncommand and save a copy of it to the cut buffer.  When given twice in a row, instead\ndelete the whole contents of the edit buffer and save a copy of it to the cut buffer.\n\nvi-delete-prev-char (vi insert: Ctrl-H, BS, Ctrl-?, DEL)\nDelete the character to the left of the cursor.  It is an error if the cursor is already\nat the beginning of the edit buffer.\n\nvi-end-big-word (vi command: E)\nMove the cursor to the end of the current space delimited word.  Can be used as a move‐\nment command after vichangemeta, videletemeta, or viyank.  It is an error if the\ncursor is already at the end of the edit buffer.\n\nvi-end-word (vi command: e)\nMove the cursor to the end of the current word.  Can be used as a movement command after\nvichangemeta, videletemeta, or viyank.  It is an error if the cursor is already at\nthe end of the edit buffer.\n\nvi-history-word (vi command: )\nInsert the first word from the most recent history entry after the cursor, move the cur‐\nsor after to the character after the inserted word, and switch to vi insert mode.  It is\nan error if there is no history entry or the most recent history entry is empty.\n\nvi-insert (vi command: i)\nEnter insert mode.\n\nvi-insert-at-bol (vi command: I)\nMove the cursor to the beginning of the edit buffer and switch to vi insert mode.\n\nvi-kill-line-prev (vi: Ctrl-U)\nDelete the string from the beginning of the edit buffer to the cursor and save it to the\ncut buffer.\n\nvi-list-or-eof (vi insert: Ctrl-D, EOF)\nIf the edit buffer is empty, indicate end of file to the program.  It is an error if the\nedit buffer is not empty.\n\nvi-match (vi command: %)\nConsider opening and closing parentheses, braces, and brackets as delimiters.  If the\ncursor is not at a delimiter, move it to the right until it gets to one, then move it to\nthe matching delimiter.  Can be used as a movement command after vichangemeta,\nvideletemeta, or viyank.  It is an error if there is no delimiter at the cursor or in\nthe string to the right of the cursor, or if the first such delimiter has no matching de‐\nlimiter.\n\nvi-next-big-word (vi command: W)\nMove the cursor to the right to the beginning of the next space delimited word.  Can be\nused as a movement command after vichangemeta, videletemeta, or viyank.  It is an\nerror if the cursor is already at the end of the edit buffer or on its last character.\n\nvi-next-char (vi command: f)\nRead one character from the terminal bypassing the normal line editing functionality and\nmove the cursor to the right to the next instance of that character in the edit buffer.\nCan be used as a movement command after vichangemeta, videletemeta, or viyank.  If\ntrying to read the character results in end of file or an error, call ed-end-of-file in‐\nstead.  It is an error if the character is not found searching to the right in the edit\nbuffer.\n\nvi-next-word (vi command: w)\nMove the cursor to the right to the beginning of the next word.  Can be used as a move‐\nment command after vichangemeta, videletemeta, or viyank.  It is an error if the\ncursor is already at the end of the edit buffer or on its last character.\n\nvi-paste-next (vi command: p)\nInsert a copy of the cut buffer to the right of the cursor.  It is an error if the cut\nbuffer is empty.\n\nvi-paste-prev (vi command: P)\nInsert a copy of the cut buffer to the left of the cursor.  It is an error if the cut\nbuffer is empty.\n\nvi-prev-big-word (vi command: B)\nMove the cursor to the left to the next beginning of a space delimited word.  Can be used\nas a movement command after vichangemeta, videletemeta, or viyank.  It is an error\nif the cursor is already at the beginning of the edit buffer.\n\nvi-prev-char (vi command: F)\nRead one character from the terminal bypassing the normal line editing functionality and\nmove the cursor to the left to the next instance of that character in the edit buffer.\nCan be used as a movement command after vichangemeta, videletemeta, or viyank.  If\ntrying to read the character results in end of file or an error, call ed-end-of-file in‐\nstead.  It is an error if the character is not found searching to the left in the edit\nbuffer.\n\nvi-prev-word (vi command: b)\nMove the cursor to the left to the next beginning of a word.  Can be used as a movement\ncommand after vichangemeta, videletemeta, or viyank.  It is an error if the cursor\nis already at the beginning of the edit buffer.\n\nvi-redo (vi command: ‘.’)\nRedo the last non-motion command.\n\nvi-repeat-next-char (vi command: ‘;’)\nRepeat the most recent character search in the same search direction.  Can be used as a\nmovement command after vichangemeta, videletemeta, or viyank.\n\nvi-repeat-prev-char (vi command: ‘,’)\nRepeat the most recent character search in the opposite search direction.  Can be used as\na movement command after vichangemeta, videletemeta, or viyank.\n\nvi-repeat-search-next (vi command: n)\nRepeat the most recent history search in the same search direction.\n\nvi-repeat-search-prev (vi command: N)\nRepeat the most recent history search in the opposite search direction.\n\nvi-replace-char (vi command: r)\nSwitch to vi replace mode, and automatically switch back to vi command mode after the\nnext character typed.  See ed-insert for a description of replace mode.  It is an error\nif the cursor is at the end of the edit buffer.\n\nvi-replace-mode (vi command: R)\nSwitch to vi replace mode.  This is a variant of vi insert mode; see ed-insert for the\ndifference.\n\nvi-search-next (vi command: ?)\nReplace the edit buffer with the next matching history entry.\n\nvi-search-prev (vi command: /)\nReplace the edit buffer with the previous matching history entry.\n\nvi-substitute-char (vi command: s)\nDelete the character at the cursor and switch to vi insert mode.\n\nvi-substitute-line (vi command: S)\nDelete the entire contents of the edit buffer, save a copy of it in the cut buffer, and\nenter vi insert mode.\n\nvi-to-column (vi command: |)\nMove the cursor to the column specified as the argument.  Can be used as a movement com‐\nmand after vichangemeta, videletemeta, or viyank.\n\nvi-to-history-line (vi command: G)\nReplace the edit buffer with the specified history entry.\n\nvi-to-next-char (vi command: t)\nRead one character from the terminal bypassing the normal line editing functionality and\nmove the cursor to the right to the character before the next instance of that character\nin the edit buffer.  Can be used as a movement command after vichangemeta,\nvideletemeta, or viyank.  If trying to read the character results in end of file or an\nerror, call ed-end-of-file instead.  It is an error if the character is not found search‐\ning to the right in the edit buffer.\n\nvi-to-prev-char (vi command: T)\nRead one character from the terminal bypassing the normal line editing functionality and\nmove the cursor to the left to the character after the next instance of that character in\nthe edit buffer.  Can be used as a movement command after vichangemeta, videletemeta,\nor viyank.  If trying to read the character results in end of file or an error, call\ned-end-of-file instead.  It is an error if the character is not found searching to the\nleft in the edit buffer.\n\nvi-undo (vi command: u)\nUndo the last change.\n\nvi-undo-line (vi command: U)\nUndo all changes to the edit buffer.\n\nvi-yank (vi command: y)\nCopy the string from the cursor to the position specified by the following movement com‐\nmand to the cut buffer.  When given twice in a row, instead copy the whole contents of\nthe edit buffer to the cut buffer.\n\nvi-yank-end (vi command: Y)\nCopy the string from the cursor to the end of the edit buffer to the cut buffer.\n\nvi-zero (vi command: 0)\nIf in argument input mode, multiply the argument by ten.  Otherwise, move the cursor to\nthe beginning of the edit buffer.  Can be used as a movement command after\nvichangemeta, videletemeta, or viyank.\n\n#### Macros\n\nIf an input character is bound to the editor command ed-sequence-lead-in, editline attempts to\ncall a macro.  If the input character by itself forms the name of a macro, that macro is exe‐\ncuted.  Otherwise, additional input characters are read until the string read forms the name of\na macro, in which case that macro is executed, or until the string read matches the beginning\nof none of the existing macro names, in which case the string including the final, mismatching\ncharacter is discarded and the terminal bell is rung.\n\nThere are two kinds of macros.  Command macros execute a single editor command.  Keyboard\nmacros return a string of characters that is appended as a new line to the Input Queue.\n\nThe following command macros are defined by default in vi command mode and in emacs mode:\n\nEsc [ A, Esc O A    ed-prev-history\nEsc [ B, Esc O B    ed-next-history\nEsc [ C, Esc O C    ed-next-char\nEsc [ D, Esc O D    ed-prev-char\nEsc [ F, Esc O F    ed-move-to-end\nEsc [ H, Esc O H    ed-move-to-beg\n\nIn vi command mode, they are also defined by default without the initial escape character.\n\nIn addition, the editline library tries to bind the strings generated by the arrow keys as re‐\nported by the terminfo(5) database to these editor commands, unless that would clobber user\nsettings.\n\nIn emacs mode, the two-character string “Ctrl-X Ctrl-X” is bound to the em-exchange-mark editor\ncommand.\n\n#### Input Queue\n\nThe editline library maintains an input queue operated in FIFO mode.  Whenever it needs an in‐\nput character, it takes the first character from the first line of the input queue.  When the\nqueue is empty, it reads from the terminal.\n\nA line can be appended to the end of the input queue in several ways:\n\n-   By calling one of the keyboard Macros.\n\n-   By calling the editor command vi-redo.\n\n-   By calling the editor command vi-alias.\n\n-   By pressing a key in emacs incremental search mode that doesn't have a special mean‐\ning in that mode but returns to normal emacs mode.\n\n-   If an application program directly calls the functions elpush(3) or elwpush(3), it\ncan provide additional, program-specific ways of appending to the input queue.\n\n### SEE ALSO\n\nmg(1), vi(1), editline(3edit), elwgets(3), elwpush(3), elwset(3), editrc(5edit)\n\n### HISTORY\n\nThis manual page first appeared in OpenBSD 6.0 and NetBSD 8.\n\n### AUTHORS\n\nThis manual page was written by Ingo Schwarze <schwarze@openbsd.org>.\n\nBSD                               May 7, 2016                              BSD\n\n"
        }
    ],
    "structuredContent": {
        "command": "editline",
        "section": "7edit",
        "mode": "man",
        "summary": "editline — line editing user interface",
        "synopsis": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "mg",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/mg/1/json"
            },
            {
                "name": "vi",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/vi/1/json"
            },
            {
                "name": "elwgets",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/elwgets/3/json"
            },
            {
                "name": "elwpush",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/elwpush/3/json"
            },
            {
                "name": "elwset",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/elwset/3/json"
            },
            {
                "name": "editrc",
                "section": "5edit",
                "url": "https://www.chedong.com/phpMan.php/man/editrc/5edit/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 13,
                "subsections": [
                    {
                        "name": "Input character bindings",
                        "lines": 187
                    },
                    {
                        "name": "Editor commands",
                        "lines": 435
                    },
                    {
                        "name": "Macros",
                        "lines": 28
                    },
                    {
                        "name": "Input Queue",
                        "lines": 18
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}