VED(1L)

๐Ÿ“ฆ version 1.8, in opensuse-leap 16.0

๐ŸŽ€ ved(1L) ๐ŸŽ€ โ€” Schilyยดs USER COMMANDS, but make it bestie-friendly

okay so welcome to VED(1L), the manual page for your new favorite screen editor โœจ we're doing this in parts, so buckle up buttercup ๐Ÿ’–


โœจ NAME โœจ

ved โ€” the visual editor, aka the screen-oriented one, aka it takes over your whole terminal and looks cute doing it ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

ved [ options ] [ filename ... ]
ved-e [ options ] [ filename ... ]
ved-w [ options ] [ filename ... ]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So Ved โ€” short for visual editor โ€” is a small and very fast screen-oriented editor, and its whole user-interface vibe sits somewhere between vi and emacs. It's powerful, it's easy to learn (fr fr, no cap), it has no limitations on line length and no limitations on the type of characters that may appear in a file. It has almost no limitations on file size either, and it supports editing of large files (like, files > 2 GB large ๐Ÿ‘‘) if the OS has large file support.

Here's the tea on how to use it:

  • To edit a file for the first time, just call ved and specify the name of the file you want to edit.
  • If you edit a file for the second time, ved will place you at the same cursor position that was used the last time you edited this file. It remembers. It cares. ๐Ÿซถ
  • If you don't specify a file name at all, ved will assume you want to edit the last file you edited in your current directory. And the cursor position in this case, again, will be the same as with the last editing session for this file.

Calling ved-e is literally the same as calling:

ved -e

and calling ved-w is the same as calling:

ved maxlinelen=78.

(yes, that trailing period is part of it, don't come for me ๐Ÿ’€)

Ved is using the termcap data base so it's independent from the terminal type. See the Termcap section below.


๐Ÿ’– OPTIONS ๐Ÿ’–

  • -v, -vhelp, -vedhelp โ€” your editing session starts with the on-line help up on screen. It's done in read-only mode, so you can look but you can't touch ๐Ÿ˜Œ
  • -r, -readonly โ€” in this mode you may edit the content of the edit buffer, but you are not allowed to write back the modified buffer by using the quit command of the editor. And if you use this option more than once, the readonly value gets incremented. Use -readonly twice or more and you're not allowed to write the file back even in quit force mode. That's the strictest vibe check possible ๐Ÿšซ
  • b=#, buffers=# โ€” by default ved uses 10 in-core buffers to edit the file, and each in-core buffer takes 8 kB (the actual values compiled into ved may be retrieved by calling ved -help). Files that are bigger than the total amount of in-core buffer space get edited by using the swap file of ved. If you specify a number higher than the default, you'll need more space in memory, but the speed will slightly increase โšก
  • -n, -nobak โ€” don't create filename.bak when writing back the file using the quit command of the editor. > Heads up bestie: if you use this option you will still break hard links. If you like to write into the original file, you should better use the W command when you quit ved.
  • -nolock โ€” don't try to use record locking to tell other editors that a file is being edited or just being written to. This option may help if NFS record locking bugs would otherwise cause an edit session to hang in the fcntl() lock request ๐Ÿ˜ญ
  • -e, -edtmp โ€” don't write to the file .vedtmp.uid. (ved normally stores the names and cursor positions of files in .vedtmp.uid.)
  • -raw8 โ€” do not expand characters with the MSB set. Note that ved will by default not expand characters with the MSB set that seem to be printable, e.g. when the terminal is in 8-bit mode. If this option is used, the expansion of 8-bit characters is turned off unconditionally. If the terminal is in 7-bit mode, this may result in incorrectly displayed characters ๐Ÿ’€
  • -d, -dos โ€” map new-line to carriage-return new-line and hide carriage-return characters that are directly followed by a new-line. If you type in a new line character, this results in inserting a carriage-return new-line pair. But since ved is acting binary transparently, reading in files that don't follow DOS newline conventions will not cause the content of the file to be automatically converted to use DOS new-lines. Also: if -nodos has not been specified, ved tries to auto-detect whether a file needs DOS (CR/LF to LF) mapping or not ๐Ÿ‘€
  • -nodos โ€” do not map new-line to carriage-return new-line and hide carriage-return characters that are directly followed by a new-line. If -nodos has been specified, auto-detection of DOS files is disabled and files will always be edited in POSIX line mode ๐Ÿงš
  • s=search string โ€” start the editing session with a search for searchstr ๐Ÿ”
  • -t, -tag โ€” first filename is really a ctag.
  • wrapmargin=# โ€” set the default wrap margin to #. The wrap margin is counted from the end of a terminal line ๐Ÿ“
  • maxlinelen=# โ€” set the max line length for autowrap to #. The behaviour is similar to the wrapmargin= option, but ved does not use the maximum linelength from the current screen width โ€” it uses the fixed length #.
  • -R, -Recover โ€” recover session from the specified filename. ved generates a file vedP.xxxx in the /var/tmp directory or in the directory named by the VED_TMPDIR environment, and all action of the user is stored in it during the session. This file must be used as the only argument to ved when running a recover session ๐Ÿฉน

๐ŸŽ€ THE STATUS LINE ๐ŸŽ€

The first (top) line of the screen is reserved for ved status information. It's divided into five fields, and here's what they are, left to right:

  • Info/Input โ€” the first field shows informational messages and fetches the extra input that some commands need. Every command that needs confirmation requests input from this field. Its size defaults to 1/4th of the length of a line, and it may use more space if needed.
  • Number โ€” the second field holds the current multiplier for the next command. This multiplier gets reset to 1 after each command, and you can set it to a different value yourself (see the NUMBERS section below). It's referred to as number in the following text. Its size is fixed to 1/8th of the length of a line. If the actual number doesn't fit in that space, the text BIG is printed instead ๐Ÿ’€
  • Takebuffer โ€” the third field holds the name of the actual take buffer used for cut and paste operations. The name of this buffer defaults to default on startup, and it may be changed by the user. Its size is fixed to 1/4th of the length of a line.
  • Filename โ€” the fourth field usually displays the current filename. Its size defaults to 1/4th of the length of a line. It may use up more space if needed and no error text is displayed, and it may be hidden for some time if a long error message is displayed ๐Ÿ™ˆ
  • Error text โ€” the fifth field is where all error messages and warnings show up. Its size defaults to 1/4th of the length of a line, and if needed it may use the space of the filename field too.

๐Ÿ’… BASIC COMMAND FORMAT ๐Ÿ’…

Ved does not distinguish between command mode and insert mode. Unless prefixed by commands that need arguments, all non control characters are treated as input (which is inserted into the file buffer). So you just type, bestie โœจ

All basic ved commands are control characters or escape sequences. To enter a control character, use the control key like the shift key together with a character key; to enter an escape sequence, press the <ESC> key followed by another key.

In the following description, ^ represents the control key and <ESC> the escape key (which is identical to pressing ^[). <ALT> has a similar usage as <ESC> but a different meaning in ved, and represents the combination ^]. The combination ^char is a single keystroke, while <ESC>char or <ALT>char are two keystrokes. If the command takes an argument, the argument is terminated with a carriage return <CR>.

A command may be modified in five ways:

  • Escape commands โ€” typing the <ESC> key (or ^[) before the command will modify it to an alternate form, usually a related function.
  • Alt commands โ€” typing the ALT key (^]) before the command inserts a mark (with a few exceptions) in the text, usually at the current cursor position, and then executes the normal command. You can precede any command that moves the cursor with the ALT key, and ved sets the mark before moving the cursor ๐ŸŽฏ
  • Alt Escape commands โ€” typing ALT (^]) and ESC (^[) before the command inserts a mark (with a few exceptions) in the text, usually at the current cursor position, and then executes the ESC command. You can precede any ESC command that moves the cursor with the ALT key and ved sets the mark before moving the cursor. Typing ESC followed by ALT yields the same effect ๐Ÿ’ซ
  • Extended commands โ€” typing a ^X before another command enters the extended mode. The extended mode just enters another level of commands. These extended commands have their own list of basic, ESC, ALT and ALT/ESC command tables.
  • Multiplied execution โ€” numbers that are entered by typing <ESC>#<CR> (# represents a positive number) will set the multiplier to that number and display it in the status line of ved. If a number greater than one is entered before a command, that command is usually repeated number times. Exceptions are some cursor movement commands, where different functions will be executed number times instead of repeating the visible basic functionality of the command ๐Ÿ‘‘

๐ŸŒˆ CURSOR MOVEMENT ๐ŸŒˆ

Like every editor, ved has a typing point called the cursor, which is indicated by the (in most cases) flashing bar or box on your screen, depending on your terminal/window type. The cursor indicates the point within the file buffer where the typed characters are going to โ€” it's literally your current place in the file buffer ๐Ÿ“ The commands that move the cursor within the file buffer are explained in this section.

Cursor movement command overview:

   Key        CTRL             ESC CTRL        ALT               ALT ESC
   Label                                       set mark first    set mark first
  • |โ† / A โ€” start of line ยท start of para ยท start of line ยท start of para
  • F2 / B โ€” go to beginning ยท go to bottom ยท go to beginning ยท go to bottom
  • โ†’| / E โ€” end of line ยท end of para ยท end of line ยท end of para
  • โ†’ / F โ€” forward char ยท forward word ยท forward char ยท forward word
  • โ† / H โ€” back char ยท back word ยท back char ยท back word
  • โ†“ / N โ€” down line ยท down para ยท down line ยท down para
  • โ†‘ / P โ€” up line ยท up para ยท up line ยท up para

(yes bestie, each row says the pair twice โ€” that's just how the table's laid out ๐Ÿ’…)

Also quick note so nothing confuses you: "para" is used as an abbreviation for "paragraph" in that table, and that's purely so the thing fits inside the standard line width. iykyk ๐ŸŽ€


๐Ÿ”Ž cursor movement commands in detail:

  • ^A โ€” moves the cursor to the beginning of the current line. If the cursor is already at the beginning, it will not move. ngl, it just sits there.
    • If number is greater than one, ^A moves the cursor that number of characters from the beginning of the current line.
  • <ESC>^A โ€” moves the cursor to the beginning of the current paragraph. If the cursor is already at the beginning, it will not move.
    • If number is greater than one, <ESC>^A moves the cursor that number of words from the beginning of the current paragraph.
  • <ALT>^A โ€” inserts the mark at the current cursor position before moving the cursor to the beginning of the current line. If the cursor is already at the beginning, it will not move, but ved will still insert the mark ๐Ÿซถ
    • If number is greater than one, <ALT>^A inserts the mark, then moves the cursor that number of characters from the beginning of the current line.
  • <ALT><ESC>^A โ€” inserts the mark at the current cursor position before moving the cursor to the beginning of the current paragraph. If the cursor is already at the beginning, it will not move, but ved will still insert the mark.
    • If number is greater than one, <ALT><ESC>^A inserts the mark, then moves the cursor that number of words from the beginning of the current paragraph.
  • ^B โ€” jumps the cursor to the beginning of the file. If you're already at the beginning of the file, it will not move.
    • If number is greater than one, ^B moves the cursor that number of lines from the beginning of the file.
  • <ESC>^B โ€” moves the cursor to the end of the file. If the cursor is already at the end of the file, it will not move.
    • If number is greater than one, <ESC>^B moves the cursor that number of lines from the end of the file.
  • <ALT>^B โ€” inserts the mark at the current cursor position before moving the cursor to the beginning of the file. If the cursor is already at the beginning of the file, it will not move, but ved still inserts the mark.
    • If number is greater than one, <ALT>^B inserts the mark, then moves the cursor that number of lines from the beginning of the file.
  • <ALT><ESC>^B โ€” inserts the mark at the current cursor position before moving the cursor to the end of the file. If the cursor is already at the end of the file, it will not move, but ved still inserts the mark.
    • If number is greater than one, <ALT><ESC>^B inserts the mark, then moves the cursor that number of lines from the end of the file.
  • ^E โ€” moves the cursor to the end of the current line. If the cursor is already at the end of the line, it will not move. โš ๏ธ here's the lil freak detail: the last character on the line is the invisible ASCII newline character NL; so when the cursor is at the end of the line, it's not sitting on a visible character. spooky but true ๐Ÿ’€
    • If number is greater than one, ^E moves the cursor that number of characters from the end of the current line.
  • <ESC>^E โ€” moves the cursor to the end of the current paragraph. If the cursor is already at the end, it will not move.
    • If number is greater than one, <ESC>^E moves the cursor that number of words from the end of the current paragraph.
  • <ALT>^E โ€” inserts the mark at the current cursor position before moving the cursor to the end of the current line. If the cursor is already at the end of the line, it will not move, but ved still inserts the mark.
    • If number is greater than one, <ALT>^E inserts the mark, then moves the cursor that number of characters from the end of the current line.
  • <ALT><ESC>^E โ€” inserts the mark at the current cursor position before moving the cursor to the end of the current paragraph. If the cursor is already at the end of the paragraph, it will not move, but ved still inserts the mark.
    • If number is greater than one, <ALT><ESC>^E inserts the mark, then moves the cursor that number of words from the end of the current paragraph.
  • ^F โ€” moves the cursor one character position to the right. โžก๏ธ
    • If number is greater than one, ^F moves the cursor that number of characters to the right.
    • Depending on the cursor position, with or without number being greater than one, ^F could move the cursor to a later line. If the cursor is at the end of the line, the cursor will move to the first position of the next line.
  • <ESC>^F โ€” moves the cursor forward to the first letter of the next word.
    • If number is greater than one, <ESC>^F moves the cursor forward that number of words.
    • Depending on the current cursor position and the value of number, <ESC>^F might move the cursor down one or more lines.
  • <ALT>^F โ€” inserts the mark at the current cursor position before moving the cursor one character to the right.
    • If number is greater than one, <ALT>^F inserts the mark, then moves the cursor that number of characters to the right.
  • <ALT><ESC>^F โ€” inserts the mark at the current cursor position before moving the cursor to the first letter of the next word.
    • If number is greater than one, <ALT><ESC>^F inserts the mark, then moves the cursor that number of words to the right.
  • ^H โ€” moves the cursor one character position to the left. โฌ…๏ธ
    • If number is greater than one, ^H moves the cursor that number of characters to the left.
    • Depending on the cursor position, ^H, with or without number being greater than one, could move the cursor up to the previous line. If the cursor is at the beginning of the line when you press ^H, the cursor will move to the last position of the previous line.
  • <ESC>^H โ€” moves the cursor to the first letter of the word just prior to its current position.
    • If number is greater than one, <ESC>^H moves the cursor that number of words backwards. Depending on the current cursor position and the value of number, the cursor may move up one or more lines.
  • <ALT>^H โ€” inserts the mark at the current cursor position before moving the cursor one character position to the left.
    • If number is greater than one, <ALT>^H inserts the mark, then moves the cursor that number of characters to the left.
  • <ALT><ESC>^H โ€” inserts the mark at the current cursor position before moving the cursor to the first letter of the previous word.
    • If number is greater than one, <ALT><ESC>^H inserts the mark, then moves the cursor that number of words to the left.
  • ^N โ€” moves the cursor down one line while keeping its horizontal position. If the cursor is on the last character of the last line when you press ^N, the cursor will not move and you will hear a beep ๐Ÿ˜ญ
    • If number is greater than one, ^N moves the cursor down that number of lines. If number is greater than the number of lines remaining in the file, the cursor will stop moving at the end of the file.
  • <ESC>^N โ€” moves the cursor to the beginning of the next paragraph.
    • If number is greater than one, <ESC>^N moves the cursor down that number of paragraphs.
  • <ALT>^N โ€” inserts the mark at the current cursor position before moving the cursor down one line. Heads up: the cursor maintains its horizontal position on the line; i.e., if the cursor was on the fifth character of the line when you pressed <ALT>^N, it will move to the fifth character of the line below. ๐ŸŽฏ
    • If number is greater than one, <ALT>^N inserts the mark, then moves the cursor down that number of lines.
  • <ALT><ESC>^N โ€” inserts the mark at the current cursor position before moving the cursor to the beginning of the next paragraph.
    • If number is greater than one, <ALT><ESC>^N first inserts the mark, then moves the cursor down that number of paragraphs.
  • ^P โ€” moves the cursor up one line while maintaining its horizontal position. If the cursor is on the first line of the file when you press ^P, the cursor will not move and you will hear a beep ๐Ÿ™ˆ
    • If number is greater than one, ^P moves the cursor up that number of lines. If number is greater than the number of lines between the cursor and the beginning of the file, the cursor will stop moving at the beginning of the file.
  • <ESC>^P โ€” moves the cursor to the beginning of the previous paragraph.
    • If number is greater than one, <ESC>^P moves the cursor that number of paragraphs prior to the cursor's position.
  • <ALT>^P โ€” inserts the mark at the current cursor position before moving the cursor up one line. Again with the horizontal position: if the cursor was on the fifth character of the line when you pressed <ALT>^P, it will move to the fifth character of the line above. โœจ
    • If number is greater than one, <ALT>^P inserts the mark, then moves the cursor up that number of lines.
  • <ALT><ESC>^P โ€” inserts the mark at the current cursor position before moving the cursor to the beginning of the previous paragraph.
    • If number is greater than one, <ALT><ESC>^P first inserts the mark, then moves the cursor up that number of paragraphs prior to its current position.

โœจ INSERTION/DELETION โœจ

Okay bestie, this is the glow-up where text appears and disappears. Every insertion happens exactly where the visible cursor is โ€” like, that's the spot, periodt. ๐Ÿ’…

All deletions get saved in two buffers: the forward delete buffer holds text deleted with forward delete commands, and the backwards delete buffer holds text deleted with backward delete commands. The characters in the backward delete buffer are saved in reverse order so they can be reinserted in the correct order. As long as you don't move the cursor and start deleting new text in either direction, the content of both the forward and the backwards delete buffer may be reinserted with the undo delete command. This lets you move text by deleting it and reinserting it after you move the cursor to another position in the file. Cute, right? ๐ŸŽ€

๐ŸŒธ Insertion/Deletion command overview ๐ŸŒธ

Here's the cheat sheet. Columns are Key, CTRL, ESC CTRL, ALT (set mark first), and ALT ESC (set mark first).

  • F3 / D โ€” CTRL: delete char; ESC CTRL: delete words; ALT (set mark first): ~; ALT ESC (set mark first): ~.
  • TAB / I โ€” CTRL: tab; ESC CTRL: ~; ALT (set mark first): tab; ALT ESC (set mark first): ~.
  • NL / J โ€” CTRL: insert new line; ESC CTRL: ~; ALT (set mark first): jump to mark; ALT ESC (set mark first): switch mark and cursor.
  • F4 / K โ€” CTRL: kill line; ESC CTRL: kill para; ALT (set mark first): kill selection; ALT ESC (set mark first): ~.
  • CR / M โ€” CTRL: insert new line; ESC CTRL: change modes; ALT (set mark first): sets mark; ALT ESC (set mark first): ~.
  • F5 / O โ€” CTRL: open line; ESC CTRL: ~; ALT (set mark first): open line; ALT ESC (set mark first): ~.
  • CTRL _ (no Key label) โ€” undo delete; ESC CTRL: ~; ALT (set mark first): clear mark; ALT ESC (set mark first): ~.
  • DEL / DEL โ€” CTRL: erase char; ESC CTRL: erase word; ALT (set mark first): ~; ALT ESC (set mark first): ~.

๐ŸŽ€ Insertion/Deletion commands in detail ๐ŸŽ€

  • ^D โ€” erases the character at the cursor position.

If number is greater than one, ^D erases that number of characters to the right of the cursor.

  • <ESC>^D โ€” erases the next word. A word is defined from the current cursor position to the next blank or carriage return.

If number is greater than one, <ESC>^D erases that number of words to the right of the cursor.

  • ^I โ€” inserts a TAB character.

If number is greater than one, ^I inserts that number of TAB characters.

  • <ALT>^I โ€” inserts the mark at the current cursor position before inserting a TAB character.

If number is greater than one, <ALT>^I inserts the mark, then inserts that number of TAB characters.

  • ^J โ€” inserts a new line at the current cursor position and moves the cursor to the beginning of the next line.

If number is greater than one, ^J inserts that number of new lines.

  • ^K โ€” erases the current line. If the cursor is located at the beginning of the line, the entire line is erased, including the carriage return at the end of the line. If the cursor is located between the beginning and end of the line, everything right of the cursor is erased, including the carriage return at the end of the line. You can use ^K to erase blank lines.

If number is greater than one, ^K erases that number of lines from the current cursor position.

  • <ESC>^K โ€” erases from the current cursor position to the end of the paragraph. The end of a paragraph is indicated by two successive carriage returns--one at the end of the last line and one on the blank line that follows the paragraph.

If number is greater than one, <ESC>^K erases that number of paragraphs.

  • <ALT>^K โ€” erases text between the mark and the current cursor position. For instance, if the mark is in the middle of the file and the cursor is at the end, the last half of the file will be erased.
  • ^M โ€” inserts a new line at the current cursor position and moves the cursor to the beginning of the next line.

If number is greater than one, ^M inserts that number of new lines.

  • ^O โ€” inserts a new line at the current cursor position, but does not move the cursor. Any text to the right of the cursor moves down to start a new line.

If number is greater than one, ^O inserts that number of new lines without moving the cursor.

  • <ALT>^O โ€” inserts a new line without moving the cursor. It inserts the mark at the beginning of the next (new) line.

If number is greater than one, <ALT>^O inserts that number of new lines without moving the cursor. It inserts the mark after the last new line.

  • ^DELETE โ€” erases the character to the left of the cursor. This acts the same as using the DELETE key alone.

If number is greater than one, ^DELETE erases that number of characters to the left of the cursor.

  • <ESC>^DELETE โ€” erases the word to the left of the cursor. This acts the same as using ^DELETE.

If number is greater than one, <ESC>^DELETE erases that number of words to the left of the cursor.

  • ^_ โ€” reinserts the last deletion. The content of the forward and backward delete buffer is cleared after reinserting the deleted text.
  • <ALT>^_ โ€” erases the mark.

๐Ÿ’– CUT/PASTE ๐Ÿ’–

These commands deal with the 'take' buffers. You can have up to 32 take buffers, each named as you choose when you use it for the first time. The name appears on the status (top) line of the terminal screen following \:. The default take buffer is "default". Slay. ๐Ÿซถ

๐ŸŒˆ Cut/Paste command overview ๐ŸŒˆ

Same deal: columns are Key, CTRL, ESC CTRL, ALT (set mark first), and ALT ESC (set mark first).

  • F6 / T โ€” CTRL: save line into paste buf; ESC CTRL: save para into paste buf; ALT (set mark first): save selection into paste buf; ALT ESC (set mark first): ~ / into paste buf.
  • F7 / V โ€” CTRL: paste; ESC CTRL: paste and clear paste buf; ALT (set mark first): replace select with paste buf; ALT ESC (set mark first): replace select clear paste buf.
  • Y โ€” CTRL: save char into paste buf; ESC CTRL: save word into paste buf; ALT (set mark first): ~; ALT ESC (set mark first): ~.
  • F8 / \ โ€” CTRL: chng paste buf; ESC CTRL: clr paste buf; ALT (set mark first): ~; ALT ESC (set mark first): ~.

๐Ÿฆ‹ Cut/Paste commands in detail ๐Ÿฆ‹

  • ^T โ€” removes a line from the file buffer and puts it in the current take buffer. The line is defined from the current cursor position to the next carriage return.

If number is greater than one, ^T removes that number of lines from the file buffer and puts them in the current take buffer.

  • <ESC>^T โ€” removes a paragraph from the file buffer and puts it in the current take buffer. A paragraph is defined from the current cursor position to two successive carriage returns--one at the end of the last line and one on the blank line that follows the paragraph.

If number is greater than one, <ESC>^T removes that number of paragraphs from the file buffer and puts them in the current take buffer.

  • <ALT>^T โ€” removes the selection (what lies between the mark and the cursor) and puts it in the current take buffer.
  • ^V โ€” pastes the contents of the current take buffer into the file at the current cursor position. The take buffer will still contain a copy of the text.
  • <ESC>^V โ€” pastes and clears the contents of the current take buffer into the file at the current cursor position. The take buffer will be empty.
  • <ALT>^V โ€” replaces the selection (what lies between the mark and the cursor) with whatever is in the current take buffer. The old content of the selection is not saved in any way. The take buffer will still contain a copy of the text.
  • <ALT><ESC>^V โ€” replaces the selection (what lies between the mark and the cursor) with whatever is in the current take buffer and clears the take buffer. The old content of the selection is not saved in any way. The take buffer will be empty.
  • ^Y โ€” removes a character from the file buffer and puts it in the current take buffer. The character at the current cursor position is the one taken.

If number is greater than one, ^Y takes that number of characters and puts them in the current buffer.

  • <ESC>^Y โ€” removes a word from the file buffer and puts it in the current take buffer. A word consists of any characters from the current cursor position up to the next blank or carriage return.

If number is greater than one, <ESC>^Y takes that number of words and puts them in the current buffer.

  • ^\ โ€” changes the current take buffer.

On the information line you will see the Take Buffer: prompt. Type a take buffer name and press the RETURN key.

If you type a new name, a new take buffer is created. If you type a name you have already used during the current editing session, you can reuse that take buffer. The take buffer name is always displayed on the information line.

  • <ESC>^\ โ€” clears any text out of the current take buffer. On the information line you will see the Buffer cleared message.

okay so the search commands go hunting for whatever text you type into the file buffer, and they may park your cursor right on the matching text ๐Ÿ’…

here's the tea: if your pattern has pattern-matching meta characters in it, the pattern matcher gets used (unless you've flipped on no magic mode โ€” see the set command below), and if there are literally no meta characters, it just does a plain simple search ๐ŸŽ€

peep match(1) for the full lore on the pattern matcher, iykyk โœจ

Search command overview, laid out for your eyeballs:

  • F9 (CTRL R) โ€” forward search
  • F9 (ESC CTRL R) โ€” reverse search
  • F9 (ALT R, sets mark first) โ€” forward search
  • F9 (ALT ESC R, sets mark first) โ€” reverse search
  • F10 (CTRL Z) โ€” re-search
  • F10 (ESC CTRL Z) โ€” reverse re-search
  • F10 (ALT Z, sets mark first) โ€” re-search
  • F10 (ALT ESC Z, sets mark first) โ€” reverse re-search

Search commands in detail ๐Ÿฆ‹

  • ^R โ€” searches forward in a file for the specified text string.

on the information line you'll see the +Search: prompt. type the string you wanna find. if that string exists between where your cursor is sitting right now and the end of the file, ved moves the cursor to that spot โœจ if ved can't find the string, the cursor does not move and you will hear a beep ๐Ÿ˜ญ

if number is greater than one, ^R finds that numbered occurrence of the string.

  • <ESC>^R โ€” searches backwards in a file for the specified text string.

on the information line you'll see the -Search: prompt. type the string you wanna find. if the string exists between the cursor's current position and the beginning of the file, ved moves the cursor there ๐Ÿ’– if ved can't find the string, the cursor does not move and you will hear a beep ๐Ÿ˜ญ

if number is greater than one, <ESC>^R finds that numbered occurrence of the string.

  • <ALT>^R โ€” searches forward in a file for the specified text string.

on the information line you'll see the +Search: prompt. type the string you want to find. when (and if) it's found, the mark is inserted at the beginning of the string and the cursor moves to the end of the string โ€” at that point the string is considered selected ๐Ÿ‘‘ if ved can't find the string, the cursor does not move, no mark is inserted, and you will hear a beep ๐Ÿ’€

if number is greater than one, <ALT>^R finds that numbered occurrence of the string.

  • <ALT><ESC>^R โ€” searches backwards in a file for the specified text string.

on the information line you'll see the -Search: prompt. type the string you want to find. when found, the mark is inserted at the beginning of the search string and the cursor moves to the end of the string โ€” the string is then considered selected ๐ŸŒธ if ved can't find the string, the cursor does not move, no mark is inserted, and you will hear a beep ๐Ÿ’€

if number is greater than one, <ALT><ESC>^R finds that numbered occurrence of the string.

  • ^Z โ€” re-searches for the last text string you asked for with the ^R, <ESC>^R, <ALT>^R, or <ALT><ESC>^R command. if you already found one occurrence of the text string, ^Z will find the next occurrence โœจ if ved can't find another occurrence, the cursor does not move and you will hear a beep ๐Ÿ˜ญ

if number is greater than one, instance, ^Z finds that numbered occurrence of the string.

  • <ESC>^Z โ€” reverses direction and re-searches for the last text string you asked for with the ^R, <ESC>^R, <ALT>^R, or <ALT><ESC>^R command. if you already found one occurrence of the text string, <ESC>^Z will find the next, or previous, occurrence, depending on your direction. for instance, if the original command was ^R, <ESC>^Z will find the previous occurrence ๐Ÿซถ if ved can't find another occurrence, the cursor does not move and you will hear a beep ๐Ÿ˜ญ

if number is greater than one, instance, <ESC>^Z finds that numbered occurrence of the string.

  • <ALT>^Z โ€” re-searches for the last text string you asked for with the ^R, <ESC>^R, <ALT>^R, or <ALT><ESC>^R command. if you already found one occurrence of the text string, <ALT>^Z will find the next occurrence, set the mark at the beginning of it, and move the cursor to the end of it ๐Ÿ”ฅ this occurrence of the string is then considered selected ๐Ÿ‘‘ if ved can't find another occurrence, the cursor does not move, no mark is inserted, and you will hear a beep ๐Ÿ˜ญ

if number is greater than one, instance, <ALT>^Z finds that numbered occurrence of the search string, with the numbering beginning from the current cursor position. for instance, if number is 4, the next three occurrences are skipped and the mark is inserted at the beginning of the fourth occurrence of the string. this happens regardless of how many occurrences of the string have already been located, unless there are not that many occurrences of the string in the file ๐Ÿ’…

  • <ALT><ESC>^Z โ€” reverses direction and re-searches for the last text string you asked for with the ^R, <ESC>^R, <ALT>^R, or <ALT><ESC>^R command. if you already found one occurrence of the text string, <ALT><ESC>^Z will find the next, or previous, occurrence, depending on your direction. for instance, if the original command was ^R, <ALT><ESC>^Z will find the previous occurrence, set the mark at the beginning of it, and move the cursor to the end of it ๐ŸŒˆ this occurrence of the search string is then considered selected ๐Ÿ‘‘

if number is greater than one, instance, <ALT><ESC>^Z finds that numbered occurrence of the search string, with the numbering beginning from the current cursor position.


๐Ÿ’พ EXITING/SAVING ๐Ÿ’พ

these commands are all about bouncing out of ved and saving the current version of the edited text into a file, bestie ๐Ÿซถ

  • ^C โ€” the QUIT command ends the editing session.

on the information line you'll see the QUITTING. PUT EDITS? (Y/W/N/F/!) prompt.

type Y if you want to save the changes made during this editing session by creating a backup file and creating a new file that holds the modified content. the backup process goes down like this:

the current backup file (if there is one) (called filename.bak) is deleted, the current file is renamed to filename.bak, and a version of the file containing the latest changes becomes filename. if there is no filename.bak, filename becomes filename.bak ๐ŸŽ€

type W if you want to save the changes made during this editing session by directly writing the new content into the old file.

type F if you want to forcibly save the changes made during this editing session. this command works similar to the Y command, but ved will ignore the state of the -readonly flag and the access rights of the file ๐Ÿ‘€ the latter will allow you to write into files without write permissions if you are super user. for exceptions on this rule, see description of the -readonly flag.

type ! if you want to forcibly save the changes made during this editing session by directly writing the new content into the old file.

type N if you want to end the session but don't want to save the changes.

if you don't want to end the session, type anything except Y, W, F, ! or N ๐Ÿ™ˆ

heads up: if the file has been locked before by another edit session or if the file has been modified more recently than the copy that has been used for the current session, you will not be allowed to save the file ๐Ÿ˜ค use the force commands (F or !) or write back using a different file name.
  • <ESC>^C โ€” the BACKUP command backs up the current file.

on the information line you'll see the BACKUP?(Y/W/N/F/!) prompt.

if you enter one of the expected answers (Y, W, ! or N) the same actions as with the QUIT command are performed, except that the controls stay inside ved after the backup command has completed โœจ

  • ^X^H โ€” calls on-line help.

on the information line you'll see the HELP(Y?) prompt. to continue editing (and abort this command), type N. to see the help file, type Y ๐Ÿ’–

note that this command may not work in case that the terminal in use outputs a backspace when typing the DEL key. in such a case, it is appropriate to type: ESC : vhelp
  • ^X^Z โ€” suspends the current editing session.

on the information line you'll see the SUSPENDING. PUT EDITS? (Y/W/N/F/!) prompt.

type Y if you want the file to be backuped and updated before suspending ved. see the QUIT command for a description of the backup process ๐ŸŽ€

type W if you want the the file to be updated in place before suspending ved.

type F if you want file to be forcibly updated before suspending ved. this command works similar to the Y command, but ved will ignore the state of the -readonly flag and the access rights of the file ๐Ÿ‘€ the latter will allow you to write into files without write permissions if you are super user. for exceptions on this rule, see description of the -readonly flag.

type ! if you want file to be forcibly updated in place before suspending ved.

type N if you want to suspend ved but don't want to save the changes before.

if you don't want to suspend ved, type anything except Y, W, F, ! or N ๐Ÿ™ˆ

same warning as before, no cap: if the file has been locked before by another edit session or if the file has been modified more recently than the copy that has been used for the current session, you will not be allowed to save the file ๐Ÿ˜ค use the force commands (F or !) or write back using a different file name.

when you're ready to continue editing, use the fg or resume command of your shell. you'll return to the editing session, and the cursor will be in the same place it was when you suspended the session, regardless of whether or not you saved your edits ๐Ÿ‘‘โœจ

โœจ FILE COMMANDS โœจ

  • ^G โ€” lets you insert another file right at the current cursor position. ๐Ÿ’–

On the information line you'll see the Get from: prompt, bestie. Type a file name and hit the RETURN key.

You can pull files in from the current working directory or from other directories (as long as the path name is actually valid, obviously). The path name gets filename-globbed by your shell โ€” so like, wild cards work as long as they expand to exactly one filename. Slay. โœจ

  • <ESC>^G โ€” exits the current file and hops into another file. ๐Ÿฆ‹

On the information line you'll see the Change to: prompt. Type the name of the file you wanna edit and press RETURN.

If the old file was modified, you'll get the CHANGING TO: filename. PUT EDITS?(Y/W/N/F/!) prompt โ€” this is asking whether you want to save and backup the edits in the current file. Literally the vibes check of the whole operation:

  • Type Y if you want the file to be backuped and updated before changing the file. See the QUIT command for a description of the backup process.
  • Type W if you want the the file to be updated in place before changing the file.
  • Type F if you want file to be forcibly updated before changing the file. This command works similar to the Y command, but ved will ignore the state of the -readonly flag and the access rights of the file. The latter will allow you to write into files without write permissions if you are super user. For exceptions on this rule, see description of the -readonly flag.
  • Type ! if you want file to be forcibly updated in place before changing the file.
  • Type N if you want to change the file but don't want to save the changes before.

If you don't want to change the edited file at all, type anything except Y, W, F, ! or N. ๐Ÿซถ

Heads up, bestie: if the file has been locked before by another edit session, or if the file has been modified more recently than the copy that has been used for the current session, you will not be allowed to save the file. Use the force commands (F or !) or write back using a different file name. No cap. ๐Ÿ’…
  • ^W โ€” writes a copy of the file you're editing to the file you specify. ๐ŸŽ€

On the information line you'll see the Write to: prompt. Type a file name and press RETURN. If the file exists, its contents are overwritten. If the file doesn't exist, it gets created. Fresh file, main character energy.

  • <ESC>^W โ€” writes the contents of the current take buffer to the file you specify. ๐ŸŒธ

On the information line you'll see the \ to file: prompt. Type a file name and press RETURN. If the file exists, its contents are overwritten. If the file does not exist, it is created. The take buffer contents will remain intact โ€” nothing lost, we love that. ๐Ÿ’œ

  • <ALT>^W โ€” writes a copy of the selection (what lies between the mark and the cursor) to the file you specify. โญ

On the information line you'll see the Sel to: prompt. Type a file name and press RETURN. If the file exists, its contents are overwritten. If the file does not exist, it is created.


๐Ÿ”ข NUMBERS ๐Ÿ”ข

  • <ESC>#<CR> โ€” to enter a multiplier that only works for the next command, type <ESC>, enter a number and then press the RETURN key. If you entered a number by mistake, simply enter <ESC>1<CR> to reset the number to its default value. Easy undo, we stan. ๐Ÿ™ˆ
  • ^U โ€” multiplies number by the multiplier. The default multiplier is 4. Each time you press ^U number changes to the next multiple of 4 (16, 16, 64, and so on). ๐Ÿ“
  • <ESC>^U โ€” changes the multiplier.

The default multiplier is 4. If you want to multiply number by a different value, use <ESC>^U. On the information line you'll see the Mult = prompt. Type a number and press the RETURN key. Custom math, iconic. ๐Ÿงš


๐ŸŒˆ MISCELLANEOUS ๐ŸŒˆ

  • <ALT>^G โ€” lets you edit your editing macro file called .vedmac (which lives in your $HOME directory). It's the same as if you used ^X^X to execute a new ved and answered N to the put question. When you're through editing .vedmac, press ^C to continue editing the file you were in when you issued the <ALT>^G command; you'll be asked whether or not you want to put the edits from .vedmac before you return to the original file. ๐Ÿ’ซ
  • <ALT>^J โ€” moves the cursor to the mark. ๐Ÿ‘‘

The current cursor position determines whether this is a forward or backward movement. For instance, if the mark is in the middle of the file and the cursor is at the beginning, its a forward movement; if the cursor is at the end, its a backward movement. Direction is giving โœจjourneyโœจ.

  • <ALT><ESC>^J โ€” switches the cursor and the mark. ๐Ÿ”„
  • ^L โ€” redisplays the current screenful of text. This is useful after a message has been sent to your terminal which may have overwritten some of the text. Clean slate, we love a refresh. ๐Ÿฆ‹
  • <ESC>^L โ€” adjusts the text displayed on the terminal screen so that the line the cursor is on becomes the optimum line on the screen. This usually is the center line of the display but it may be changed using the <ESC>:set optline # <CR> command. This may involve displaying different text, depending on where the cursor is when you use this command. Centering your fave line, iconic behavior. ๐ŸŽ€
  • <ALT>^L โ€” Adjusts the current Line of the Cursor to be the first Line on Screen. ๐Ÿ“Œ
  • <ESC>^M โ€” changes modes. ๐Ÿ”ฅ

On the information line you'll see the Mode?(ORV8) prompt. Type:

  • D to enable or disable DOS mode.
  • V for visible mode.
  • O for overstrike mode.
  • 8 to enable or disable raw8 mode.
  • R to reset back to default mode.
  • <CR> to list the current mode settings.

If you type anything else, you will abort the command. Mood, honestly.

  • <ALT>^M โ€” sets a mark at the current cursor position. ๐Ÿซถ
  • <ESC>n โ€” displays the next Page of file. โญ
  • <ESC>p โ€” displays the previous Page of file. โญ
  • <ALT><ESC>n โ€” Sets a Mark, then displays the next Page of file. ๐Ÿ’œ
  • <ALT><ESC>p โ€” Sets a Mark, then displays the previous Page of file. ๐Ÿ’œ
  • ^Q โ€” unfreezes the screen which was frozen by pressing ^S. ๐ŸงŠโžก๏ธ๐Ÿ”ฅ
  • ^S โ€” freezes cursor and text movement on the screen. Use ^Q to unfreeze it. โ„๏ธ
  • ^X^X โ€” lets you execute a shell command without terminating the editing session. ๐Ÿ’€โœจ

Control temporarily returns to the Command Interpreter while the command is executed, then you can continue editing. For instance, if you want to read another file into the one you're editing but can not remember the file name, you can execute an ls command to find its name. When you type ^X^X, you'll see the Execute: prompt on the information line. Type the command line and press the RETURN key. If the file was modified before you called ^X^X, you'll see the EXECUTING. PUT EDITS? (Y/W/N/F/!) prompt.

  • Type Y if you want the file to be backuped and updated before executing the command. See the QUIT command for a description of the backup process.
  • Type W if you want the the file to be updated in place before executing the command.
  • Type F if you want file to be forcibly updated before executing the command. This command works similar to the Y command, but ved will ignore the state of the -readonly flag and the access rights of the file. The latter will allow you to write into files without write permissions if you are super user. For exceptions on this rule, see description of the -readonly flag.
  • Type ! if you want file to be forcibly updated in place before executing the command.
  • Type N if you want to execute the command but don't want to save the changes before.
Fr fr bestie: if the file has been locked before by another edit session or if the file has been modified more recently than the copy that has been used for the current session, you will not be allowed to save the file. Use the force commands (F or !) or write back using a different file name. ๐Ÿ’…

In all cases, after returning from the command, the cursor will be on the same place as it was before typing ^X^X. Cursor stays put, main character never moves.

Note that if the shell command you want to execute requires the current file as an argument, you might need to update it. For instance, if you the file you are editing contains formatting commands that you want to test, you will need to update the file so that the version of the file you format and view is the most up-to-date one. ๐Ÿ˜ญ

To abort the command while you can see the Execute: prompt, do not type a command; simply press the RETURN key. If you had started to type a command, use the DELETE key to erase it; the field following the prompt must be blank. To abort the command while you can see the EXECUTING. PUT EDITS? (Y/W/N/F/!) prompt, type anything except Y, W, F, ! N. Escape route secured. ๐Ÿ™ˆ

  • <ESC>^X โ€” executes the contents of the current take buffer. ๐ŸŒŸ

You can type a shell command line in your file and then save it in a take buffer (using the ^T, <ESC>^T, ^Y or <ESC>^Y commands). Literally writing your own destiny.

When you type <ESC>^X, you'll see the EXECUTING. PUT EDITS? (Y/W/N/F/!) prompt on the information line.

  • Type Y if you want the file to be backuped and updated before executing the command. See the QUIT command for a description of the backup process.
  • Type W if you want the the file to be updated in place before executing the command.
  • Type F if you want file to be forcibly updated before executing the command. This command works similar to the Y command, but ved will ignore the state of the -readonly flag and the access rights of the file. The latter will allow you to write into files without write permissions if you are super user. For exceptions on this rule, see description of the -readonly flag.
  • Type ! if you want file to be forcibly updated in place before executing the command.
  • Type N if you want to execute the command but don't want to save the changes before.

oh and also, if you don't want the command to actually run, just type literally anything that isn't Y, W, F, ! or N and you're out. ๐Ÿซถ

and bestie, real talk: if the file got locked earlier by another edit session, or if the file's been modified more recently than the copy your current session has been using, ved is gonna straight up not let you save. ๐Ÿ˜ญ use the force commands (F or !) or write back under a different file name. those are the moves. ๐Ÿ’…

  • <ALT>^X โ€” executes the selection (what lies between the mark and the cursor). ๐ŸŽฏ

you can literally type a shell command line in your file and then select it. iconic behaviour fr.

when you hit <ALT>^X, you'll see the EXECUTING. PUT EDITS? (Y/W/N/F/!) prompt chilling on the information line. here's the menu:

  • Y โ€” file gets backed up and updated before executing the command. (see the QUIT command for the whole backup-process lore ๐Ÿ‘‘)
  • W โ€” file gets updated in place before executing the command.
  • F โ€” file gets forcibly updated before executing the command. works similar to the Y command, but ved ignores the state of the -readonly flag and the access rights of the file. the latter means you can write into files without write permissions if you're super user โœจ. for exceptions on this rule, go read the description of the -readonly flag, iykyk.
  • ! โ€” file gets forcibly updated in place before executing the command.
  • N โ€” execute the command but don't save the changes first. living dangerously, love that.
  • anything else โ€” the command does not execute. bye ๐Ÿ’€

and again, because it matters: if the file has been locked before by another edit session, or if the file has been modified more recently than the copy that's been used for the current session, you will not be allowed to save. use the force commands (F or !) or write back using a different file name. no cap. ๐Ÿšจ

  • ^@ โ€” indicates the current line number. this number tells you how many lines exist between the beginning of the file and the current cursor position. ๐Ÿงฎ

on the information line you'll see +Line: 333 where 333 is the current line number.

  • <ESC>^@ โ€” indicates how many lines exist between the current cursor position and the end of the file. ๐ŸŒˆ

on the information line you'll see -Line: 22 where 22 is the number of lines remaining in the file.

  • <ALT>^@ โ€” indicates what line the mark is on, in relation to the beginning of the file. ๐Ÿ“

on the information line you'll see +Line: 45 where 45 is the positive line number on which the mark is located.

if there is no mark, you'll see No mark! displayed on the far right of the information line. ๐Ÿ˜ญ

  • <ALT><ESC>^@ โ€” indicates what line the mark is on, in relation to the end of the file. ๐ŸŒธ

on the information line you'll see -Line: 109 where 109 is the negative line number on which the mark is located.

if there is no mark, No mark! shows up on the far right of the information line. same energy as above tbh.

  • ^[ โ€” same as using the <ESC> key.
  • ^] โ€” is <ALT>. use this sequence of keystrokes to start an ALT command. ๐Ÿฆ‹
  • ^X โ€” the lead-in character for an extended command.
  • <ESC>^] โ€” same as using <ALT><ESC>.
  • ^^ โ€” quotes the next character so it's taken literally, and then it gets converted to a control character. for instance, if you wanna include a command inside a macro definition, you must quote the keystroke sequence โ€” otherwise the command gets executed instead of becoming part of your macro. subtle but huge. ๐Ÿ’…
  • <ESC>^^ โ€” quotes the next character so it becomes an 8 bit character.
  • <ALT>^^ โ€” quotes the next character so it becomes an 8 bit control character.
  • <ALT><ESC>^^ โ€” quotes the next character so you type it in in hexadecimal notation. fancy ๐Ÿ”ฅ
  • <ALT><ALT> โ€” goto tag, where a tag is a word located at the cursor position. see the FILES section for more information on the tag file. ๐Ÿท๏ธ
  • <ESC><ALT><ALT> โ€” pop the tag stack by one entry. every time you go to a tag, the old location gets pushed on top of the tag stack. it's giving browser back button but make it vintage. ๐Ÿ‘‘
  • <ESC>% โ€” search for matching parenthesis. if this command is entered, the cursor gets put to the parenthesis that matches the parenthesis where the cursor is currently located. ๐Ÿ˜Œ
  • <ESC>* โ€” execute temporary macro. one temporary macro may be set up using the <ESC>:macro command.
  • <ESC>: โ€” introduce a colon command. see the COLON COMMANDS section for the full tea. ๐Ÿซ–

๐ŸŽ€ COLON COMMANDS ๐ŸŽ€

colon commands are introduced via <ESC>: โ€” the command then gets entered on the (top) status line of ved. very main character of them. โœจ

the colon commands are:

  • backup โ€” backup the current file. this command is the same as when <ESC>^C is entered. it may be needed if for some reason it is not possible to enter the interrupt character of the terminal driver. ๐Ÿซถ
  • bind โ€” print the current command binding for ved. later versions of ved may allow modification of the binding with this command. (future tea โ˜•)
  • help โ€” print online help for the available colon commands. ๐Ÿงš
  • macro macro body โ€” set up a temporary macro that may be executed via <ESC>*.
  • map
  • map from-string to-string โ€” the first form lists all currently active mappings, the second form sets up a new mapping. ๐Ÿ—บ๏ธ
  • next โ€” switch to next file in the file list. this command may only be used if ved has been called with more than one file argument. ๐Ÿ‘ฏ
  • prev โ€” switch to previous file in the file list. same rule, bestie: this command may only be used if ved has been called with more than one file argument.
  • quit โ€” quit ved. this command is the same as when ^C is entered. it may be needed if for some reason it is not possible to enter the interrupt character of the terminal driver.
  • set
  • set set-variable set-args โ€” the first form lists the current settings of ved, the second form sets a specific property of ved. the variables that may be modified via the set command are:
    • autoindent โ€” if set, ved activates the auto indent mode. subsequent lines will be automatically indented with the same indent as the previous line. switch off with <ESC>:set noautoindent. โœจ
    • linelen new-linelen โ€” set the linelength that is used as base for screen updates. this linelength usually is retrieved from the terminal driver but may be modified manually.
    • magic โ€” switch to magic mode for pattern matching (this is the default when ved has been started). if in magic mode, matching is done using regular expression pattern matching. this mode may be switched off with <ESC>:set nomagic. if magic mode is turned off, matching is done without using regular expression matching, even if the pattern contains magic characters for pattern matching. ๐Ÿช„
    • markwrap โ€” mark wrapped lines with a \ character at the end of a visible terminal line (this is the default when ved has been started). this mode may be switched off with <ESC>:set nomarkwrap.
    • optline opt-line โ€” set the optimal line. this is the line (counted from the top of the terminal) where the cursor is adjusted to when ved does scrolling. it is set by default to the half of the number of lines of the terminal. ๐ŸŽฏ
    • pmargin page-margin โ€” set the distance you need to have between the cursor and the upper or lower border of the terminal. if you cross this border, ved will start to scroll and adjust the cursor to the optimal line. it is set by default to 0 and allows one to place the cursor to any visible line on the screen.
    • psize page-size โ€” set the pagesize that is used as base for screen updates. this pagesize usually is retrieved from the terminal driver but may be modified manually.
    • tabstop tab-width โ€” set the size of a visible tab character. this width is set to 8 by default.
    • taglength tag-len-value โ€” set the number of characters that are used to compare a tag name with a tag label in the tags file. if it is set to 0 (the default), ved compares the complete tag length.
    • tags tag-file-list โ€” set the list of files that is searched when looking for a tag data base. the tag file list is separated by blanks and by default set to
tags .. /usr/lib/tags

this means that ved will first look for a file tags in the current directory, then search up for (directory by directory until the root directory is reached) a file tags, and last it will look for a file /usr/lib/tags. ๐Ÿ—‚๏ธ

  • wrapmargin wrap-margin โ€” if wrapmagin is set, ved will activate the auto-warp mode. in auto-wrap mode, ved will automatically insert a newline before a word if the cursor is less than wrap-magin from the right terminal border. (ok so the spelling is a lil goofy in the original and we're keeping it verbatim โ€” don't come for me ๐Ÿ™ˆ)
  • substitute /old/new/ โ€” substitute pattern old by new. the pattern new may contain an & for the old string. ๐Ÿ”
  • tag tag-name โ€” goto tag named tag-name. see the FILES section for more information on the tag file. ๐Ÿท๏ธ
  • vhelp โ€” edit the online help file. this is the same as calling ved -vhelp. ๐Ÿ’œ

๐ŸŒŸ MACROS ๐ŸŒŸ

Okay bestie, macros in ved are literally your little combo moves โ€” a mix of ved basic commands and input text. To make one, edit the file .vedmac in your home directory. You can do that by either explicitly typing ved ~/.vedmac or by using the built-in ved command <ALT>^G. ๐Ÿ’…

The file ~/.vedmac contains a number of lines, and each one holds a macro definition like this:

L:/*^[74^M-*/: Comment Line

Each macro definition has three fields:

  • name โ€” the name of the macro. In our case itโ€™s simply L, and the macro may be executed by typing <ESC>L.
  • function โ€” the implementation of the macro. In our case the function contains /*^[74^M-*/ and will draw a C-comment line that contains 74 - chars as the body.
  • comment โ€” a comment for better understanding of the macro file. The comment is ignored.

The fields are separated by a colon. Macros may be combined to form new macros. They also may recursively call each other, and you may set number to a value greater than one to execute a macro more than once. There is currently no way to execute a macro in a conditional way. ๐Ÿ˜ญ

๐Ÿฆ‹ MAPPINGS ๐Ÿฆ‹

You may create mappings in ved that contain arbitrary character sequences. To create a mapping, edit the file .vedmap in your home directory.

The file ~/.vedmap contains a number of lines with the following structure:

  map_from:map_to:comment

and holds a map definition like this:

\E[193z:^C:Quit Editor  (L2)

Each map definition has three fields:

  • map-from โ€” the from string (left-hand side) of the map. In our case the name is the sequence \E[193z, which is the output of the L2 function key on a Sun keyboard. Every time you type the character sequence \E[193z, or hit a function key that emits this character sequence, it gets replaced by the replacement string before the input is read by ved.
  • map-to โ€” the replacement string (the right-hand side, aka the to string) of the macro. In our case the map expands to ^C and will quit ved.
  • comment โ€” a comment for better understanding of the map file. The comment is ignored.

If both map_from and map_to are empty, the related line is ignored by the mapper, so a line may contain:

::comment

A nul character in either map_from or map_to is currently not supported, but an empty map_to is interpreted as a nul character.

If a line has an empty map_to and the comment field starts with a * like this:

map_from::*comment

an existing mapping is removed. This permits ignoring unwanted mappings that have been set up from the TERMCAP entry. A typical use case for this feature is to avoid the mapping:

^H:^?:Key Backspace -> Delete Char

that is caused by the TERMCAP capability kb for terminals that create a backspace with the delete key.

Since the file $HOME/.vedmap is read in a sequential way, a later line with the same map_from may establish a different mapping.

The fields are separated by a colon. The text in the macro file is fed through tdecode() to allow the same escape sequences as you may have in the termcap file. โœจ

๐ŸŽ€ Input Mappings ๐ŸŽ€

Ved maps input from the terminal into mapped text before it is interpreted by the editor. If a match is found on the input from the terminal, the related input text is directly replaced by its replacement string. A mapping may be prevented by typing the map quote character, which is the nul character (^@), directly before the matching text is entered. If this text is usually interpreted by ved, you first need to type the ved quoting character ^^. To be sure that you are able to literally enter some text, type ^^^@ (control up-arrow followed by Nul and the text). ๐Ÿซถ

At startup, ved first tries to initialize the terminal setup using the variables HOME, TERM, TERMCAP and TERMPATH.

If TERM is not set, the mapper establishes standard mappings for the cursor keys assuming an ANSI-compatible terminal.

If TERM is set, the mapper establishes mappings for the following termcap capabilities:

  • ku โ€” Key cursor up, mapped to ^P. The cursor is placed on the previous line.
  • kd โ€” Key cursor down, mapped to ^N. The cursor is placed on the next line.
  • kr โ€” Key cursor forward (right), mapped to ^F. Move cursor one character to the right.
  • kl โ€” Key cursor left, mapped to ^H. Move cursor one character to the left.
  • kh โ€” Key cursor -> Home, mapped to ^A. The cursor is moved to the beginning of the current line.
  • @7 โ€” Key cursor -> End, mapped to ^E. The cursor is moved to the end of the current line.
  • kD โ€” Key Delete Character, mapped to \177 (DEL). Erase one character to the left of the cursor.
  • kb โ€” Key Backspace, mapped to \177 (DEL). Erase one character to the left of the cursor.
Note that the Backspace Key is the larger key that is just above the Carriage Return Key. In former times, this key was called Delete and sent the \177 (DEL) character. Since companies followed the design of the IBM PC keyboard layout, the related key usually sends \010. If you like to literally enter a backspace, type ^^^@^H (control up-arrow followed by Nul followed by ^H).
  • k1 โ€” Key F1, mapped to Quit Editor (^C).
  • k2 โ€” Key F2, mapped to Top of File (^B).
  • k3 โ€” Key F3, mapped to Delete char (^D).
  • k4 โ€” Key F4, mapped to Delete line (^K).
  • k5 โ€” Key F5, mapped to Open line (^O).
  • k6 โ€” Key F6, mapped to Cut line (^T).
  • k7 โ€” Key F7, mapped to Paste (^V).
  • k8 โ€” Key F8, mapped to Change buffer (^ ).
  • k9 โ€” Key F9, mapped to Search down (^R).
  • k; โ€” Key F10, mapped to Re search (^Z).
  • F1 โ€” Key F11, mapped to Get from (^G).
  • F2 โ€” Key F12, mapped to Write to (^W).
  • kA โ€” Key Insert, mapped to Insert line (^A^O).
  • kE โ€” Key Clear EOL, mapped to Delete to eol (^K).
  • kL โ€” Key delete line, mapped to Delete line (^A^K).
  • kN โ€” Key Page down, mapped to Page down (^[n).
  • kP โ€” Key Page up, mapped to Page up (^[p).
  • kS โ€” Key Clear EOS, mapped to Delete to end of screen (^[999999\015^K).

After the mappings from the termcap entry for the current terminal type have been established, ved tries to read the file $HOME/.vedmap to retrieve additional mappings.

๐Ÿงš Termcap ๐Ÿงš

The termcap data base is used to make ved independent from the terminal capabilities. Cursor key output is retrieved from the data base and mapped to the cursor movement commands of ved.

Ved uses a real termcap database, not terminfo. It is advised to have a suitable termcap database available, either in the file /etc/termcap or in the private file $HOME/.termcap with an entry for the terminal type that is currently in use. If an entry for the current terminal could not be found, ved uses a builtin terminal description for a minimal ansi compatible terminal.

The following variables are used by termcap:

  • HOME โ€” to find the private files like $HOME/.termcap.
  • TERM โ€” a name representing the type of the current terminal.
  • TERMCAP โ€” this environment variable holds either a precompiled termcap entry or the pathname to be used to find a termcap database file. If it holds a precompiled entry that does not match the TERM environment, the termcap database is parsed as if the TERMCAP environment is not set. See section Parameter Substitution above for more information.
  • TERMPATH โ€” if TERMCAP is empty or not set, then the TERMPATH environment is scanned for pathnames of files that contain a termcap database. It holds a list of filenames separated by colons or spaces (i.e., ":" or " "). See section Parameter Substitution above for more information.

The following escape sequences are understood by the termcap implementation used by ved:

  • \\ โ€” the literal character \.
  • \E โ€” the ESC character (ASCII 033).
  • \e โ€” the ESC character (ASCII 033).
  • \^ โ€” the literal character ^.
  • \: โ€” the literal character :.
  • \, โ€” the literal character ,.
  • \b โ€” the BACKSPACE character (ASCII 010).
  • \f โ€” the FORMFEED character (ASCII 014).
  • \l โ€” the LINEFEED character (ASCII 012).
  • \n โ€” the NEWLINE character (ASCII 012).
  • \r โ€” the CR character (ASCII 015).
  • \s โ€” the SPACE character (ASCII 040).
  • \t โ€” the TAB character (ASCII 007).
  • \v โ€” the VERTICAL TAB character (ASCII 013).
  • ^c โ€” maps to control(c) for any appropriate c.
  • ^? โ€” the DEL character (ASCII 0177).
  • \nnn โ€” maps to a character with the octal representation nnn with 1..3 octal digits.
  • \0 โ€” maps to ASCII 0200.
  • ^@ โ€” maps to ASCII 00.

Mapping \0 to ASCII 0200 is required by the termcap documentation. A real nul character created from (^@) is currently neither supported by the upper layers of termcap, nor by the upper layers of the mapper. ๐Ÿ’€

๐ŸŒธ ENVIRONMENT ๐ŸŒธ

okay bestie, these are the environment variables that make ved do its little environment-variable glam โœจ

  • SHELL โ€” the shell to use for shell command escapes, file name globbing and similar. literally the go-to for shell stuff ๐Ÿ’…
  • HOME โ€” used to find the private files ~/.vedmac, ~/.vedmap and ~/.termcap. home sweet home, but make it config ๐Ÿ 
  • TERM โ€” the type of terminal for which the output should be formatted. yes, the terminal vibe check ๐Ÿ‘‘
  • TERMCAP โ€” this environment variable holds either a precompiled termcap entry or the pathname to be used to find a termcap database file. if it holds a precompiled entry that does not match the TERM environment, the termcap database is parsed as if the TERMCAP environment is not set. no cap, that's the rule ๐Ÿซถ
  • TERMPATH โ€” if TERMCAP is empty, then the TERMPATH environment is scanned for pathnames of files that contain a termcap database. it holds a list of filenames separated by colons or spaces (i.e., ":" or " "). if the TERMPATH symbol is not set, the files $HOME/.termcap and /etc/termcap are scanned in that order. iconic fallback behavior ๐Ÿ’–
  • BEEP โ€” the environment variable BEEP is used to suppress beeping when set to off. this helps to use ved on a notebook in a meeting. yes bestie, silent-mode main character energy ๐Ÿคซ
  • PATH โ€” the environment variable PATH is used to find the on-line help file of ved. help me help you ๐Ÿ”
  • SLASH โ€” if the environment variable SLASH is set to 'off', no slashes are accepted in filenames. slash? not today, bestie ๐Ÿšซ
  • VED_FTMPDIR โ€” fast tmp directory. the directory where the ved swap file vedF.processid is stored. if VED_FTMPDIR is not specified, the swap file will usually be stored in /tmp/. speedy little temp spot โšก
  • VED_TMPDIR โ€” general tmp directory. the directory where all ved tmp files except the swap file are stored. if VED_FTMPDIR is not defined but VED_TMPDIR is defined, all ved tmp files will be placed into this directory. if VED_TMPDIR is not specified, the other ved tmp files will usually be stored in /var/tmp/. the general admission tmp area ๐ŸŽŸ๏ธ
  • VED_STATISTICS โ€” if set and ved has been compiled with statistics support, ved will print statistic information at the end of a session. numbers girlies rise ๐Ÿ’…

๐ŸŽ€ FILES ๐ŸŽ€

these are the files ved is obsessed with, fr fr ๐Ÿ—‚๏ธ

  • /etc/termcap โ€” the system's terminal capabilities database.
  • ~/.termcap โ€” the private terminal capabilities database.
  • ~/.vedmac โ€” contains private macro definitions.
  • ~/.vedmap โ€” contains private mappings.
  • ~/.vedtmp.uid โ€” contains the names of the files that have been edit from the current directory as well as the cursor position of the last visit. ved also keeps track of the last edited file.
  • tags โ€” this file contains a list of tags that tell ved where a definition for a tag may be found. tags may contain e.g. function names, macro names and typedefs. by default, ved looks for a tags file in the current directory and if a tags file is not found in the current directory, the directories above the current directory are searched until the root directory is reached. if a tags file can be found in a directory closer to the root directory, ved will modify the file path from within the tags file to reflect the directory distance to this tags file. this property is unique to ved. ved accepts tags files in the same notation as vi. tag treasure hunt, lowkey iconic ๐Ÿ”–
  • /tmp/vedF.processid โ€” the ved swap file.
  • /var/tmp/vedB.processid โ€” the ved backward delete buffer.
  • /var/tmp/vedD.processid โ€” the ved forward delete buffer.
  • /var/tmp/vedT.processid โ€” the current take buffer.
  • /var/tmp/vedTpastename.processid โ€” one file for every named take buffer.
  • /var/tmp/vedP.processid โ€” the ved crash recovery protocol buffer.
  • /var/tmp/vedX.processid โ€” the ved shell command execute buffer.
  • .../man/help/ved.help โ€” the on-line help file is assumed to be in the same directory tree as the ved binary.

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

go read those too, bestie, iykyk ๐Ÿ’œ


๐Ÿ“ NOTES ๐Ÿ“

unlike vi, ved is not based on a line editor. this avoids annoying bugs but may cause to irritate people who are used to work with vi. so likeโ€ฆ different breed, same terminal energy ๐Ÿ˜ญ

since ved uses a private implementation of the termcap terminal independent screen package, ved uses /etc/termcap even on systems that usually emulate termcap with terminfo. this allows us to use the portable terminal description on all operating systems. from my current point of view, ved will never switch towards terminfo. although terminfo provides more functionality than termcap, it tends to be non-portable between different platforms. while termcap allows one to have a private terminal database in the NFS mounted home directory, the same attempt tends to give problems with terminfo if a vendor did make private additions. because termcap explicitly names all capabilities, there are less problems with private additions; terminfo only uses an array index to identify a specific capability so this method only works if there is a global unique implementation. termcap said โ€œname every capability,โ€ terminfo said โ€œindex go brrrโ€ โ€” and ved is team termcap periodt ๐Ÿงš

if your platform does not provide an /etc/termcap file, or if your termcap database does not contain an entry for the terminal type you are using, the following command may be used to convert a terminfo entry into a termcap entry and to append it to your private termcap database

incofmp -C >> $HOME/.termcap

make sure that the TERM environment is assigned to the correct terminal type. no guessing, bestie โœ…

if the eighth bit of a character is "on", the tilde character ~ appears before characters, i.e., ~C. tiny tilde cameo ๐ŸŒˆ


๐Ÿ’€ BUGS ๐Ÿ’€

none currently known. not me saying โ€œno bugsโ€ with my whole chest ๐Ÿ’€โœจ

mail bugs and suggestions to schilytools@mlists.in-berlin.de or open a ticket at https://codeberg.org/schilytools/schilytools/issues.

the mailing list archive may be found at:

https://mlists.in-berlin.de/mailman/listinfo/schilytools-mlists.in-berlin.de


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Joerg Schilling and the schilytools project authors. royalty behavior, honestly ๐Ÿ‘‘


๐ŸŒˆ SOURCE DOWNLOAD ๐ŸŒˆ

the source code for ved is included in the schilytools project and may be retrieved from the schilytools project at Codeberg at:

https://codeberg.org/schilytools/schilytools/

the download directory is:

https://codeberg.org/schilytools/schilytools/releases


๐Ÿ’– okay thatโ€™s the whole VED(1L) glow-up, bestie โ€” cute little source/version + date sign-off: Joerg Schilling ยท 2022/09/14 ยท VED(1L). slay and stay hydrated ๐Ÿซถ๐Ÿ’…

๐Ÿ“ฆ where this page comes from