Term::...Command(3pm)
π Term::ReadLine::Zoid::ViCommand β a readline command mode π
okay so bestie, before we get into it: this page is part of the User Contributed Perl Documentation for Term::ReadLine::Zoid::ViCommand. she's a readline command mode and she's iconic. let's go. π«Ά
πΈ NAME πΈ
Term::ReadLine::Zoid::ViCommand β a readline command mode. literally what it says on the tin, no cap.
π¦ SYNOPSIS π¦
This class gets used as a mode under Term::ReadLine::Zoid. head over there for the usage deets, because that's where the actual instructions live.
β¨ DESCRIPTION β¨
so this mode gives you a "vi command mode" exactly as specified by the posix spec for the sh(1) utility. it intends to include at least every key-binding that posix spec mentions for vi mode in sh(1). on top of that it also has some extensions borrowed from vim(1), plus a few private extensions of its own. main character energy tbh.
this mode keeps a "kill buffer" that stores the last killed text so you can yank it back again. important: this buffer has only one value β it is not a "kill ring". one (1) value. that's it. periodt.
π KEY MAPPING π
since ViCommand inherits from MultiLine, which in turn inherits from Term::ReadLine::Zoid, key bindings get inherited too β unless they're explicitly overloaded. inherited slay.
Control-d is ignored in this mode. just straight up ignored. π
escapeβ Reset the command mode.return,^Jβ Return the current edit line to the application for execution.^Zβ Send aSIGSTOPto the process of the application. Might not work when the application ignores those, which is something shells tend to do.iβ Switch back to insert mode.Iβ Switch back to insert mode at the begin of the edit line.aβ Enter insert mode after the current cursor position.Aβ Enter insert mode at the end of the edit line.mβ Switch to multiline insert mode, seeTerm::ReadLine::Zoid::MultiLine. (private extension)Mβ Switch to multiline insert mode at the end of the edit buffer. (private extension)Rβ Enter insert mode with replace toggled on. (vim extension)#β Makes current edit line a comment that will be listed in the history, but won't be executed. Only works if the'comment_begin'option is set.=β Display possible shell word completions, does not modify the edit line.\β Do pathname completion (usingFile::Glob) and insert the largest matching part in the edit line.*β Do pathname completion but inserts all matches.[count] @ charβ Regard the contents of the alias_charas a macro with editing commands. This seems a rather obfuscated feature of the posix spec to me. See also below for the alias command. Note that the count argument is not posix compliant, but it seems silly not to use it.[count] ~β Reverse case for count characters.[count] .β Repeat the last non-motion command. If no count is specified the original count of the command is used.vβ Edit the buffer with the editor specified by the"EDITOR"environment variable or the editor option, defaults to'vi'. This function requires theFile::Tempmodule from cpan, which in turn needsFile::Specand other packages. If these are not available this functions is disabled.[count] l,[count] spaceβ Move the cursor to the right.[count] hβ Move the cursor to the left.[count] w,[count] Wβ Move the cursor to the begin of the next word or bigword. (A bigword exists of non-whitespace chars, while a word exists of alphanumeric chars only.)[count] e,[count] Eβ Move the cursor to the end of the current word or bigword.[count] b,[count] Bβ Move the cursor to the begin of the current word or bigword.^β Move the cursor to the first non-whitespace on the edit line.$β Move the cursor to the end of the edit line.0β Move the cursor to the begin of the edit line.[count] |β Set the cursor to position count (1-based).[count] f charβ Set cursor to count'th occurrence of char to the right. The cursor is placed on char.[count] F charβ Set cursor to count'th occurrence of char to the left. The cursor is placed on char.[count] t charβ Set cursor to count'th occurrence of char to the right. The cursor is placed before char.[count] T charβ Set cursor to count'th occurrence of char to the left. The cursor is placed after char.[count] ;β Repeat the last'f','F','t', or'T'command. Count of last command is ignored.[count] ,β Like';'but with direction reversed.[count] c motionβ Delete characters between the current position and the position after the motion, count applies to motion. After the deletion enter insert mode. The "motion"'c'deletes the current edit line.Cβ Delete from cursor to end of line and enter insert mode.Sβ Delete current line and enter insert mode.[count] r charβ Replace the character under the cursor (and the count characters next to it) with char.[count] _β Insert a white space followed by the last (or count'th) bigword from the previous history entry ans enter insert mode. Quotes are not respected by this function.[count] xβ Delete count characters and place them in the save buffer.[count] Xβ Delete count characters before the cursor position and place them in the save buffer. ('x'is like'delete','X'like backspace)[count] d motionβ Delete from the current cursor position to the position resulting from count times motion. The deleted part will be placed in the save buffer. The "motion"'d'deletes the current line.Dβ Delete from the cursor position until the end of the line and put the deleted part in the save buffer.[count] y motionβ Yank (copy) characters from the current cursor position to the position resulting from count times motion to the save buffer. the "motion"'y'yanks the current line.Yβ Like y but from cursor till end of line.[count] pβ Insert count copies of the the save buffer after the cursor.[count] Pβ Insert count copies of the the save buffer before the cursor.uβ Undo the last command that changed the edit line.Uβ Undo all changes. TODO all changes since when ? since entering the command mode ?[count] k,[count] -β Go count lines backward in history.[count] j,[count] +β Go count lines forward in history.[number] Gβ Go to history entry number number, or to the first history entry.nβ Repeat the last history search by either the'/'or'?'minibuffers or the incremental search mode.Nβ Repeat the last history search in the oposite direction.:β Opens a command mini buffer. This is a very minimalistic execution environment that can for instance be used to modify options if the application doesn't provide a method to do so. Also it is used for quick hacks ;) The execution of this buffer happens entirely without returning to the application. (This is a vim extension)/β Opens a mini buffer where you can type a pattern to search backward through the history. The search patterns are not globs (as posix would have them), but are evaluated as perl regexes. An empty pattern repeats the previous search.?β Like'/'but searches in the forward direction.^Aβ If cursor is on a number, increment it. (This is a vim extension) FIXME bit buggy^Xβ If cursor is on a number, decrement it. (This is a vim extension) FIXME bit buggy
π₯ COMMANDS π₯
these ones you can run from the ":" mini buffer. some of them are borrowed from vim, but no guarantee what so ever. i said what i said. π
quitβ Return undef to the application (like'^D'in insert mode).set [+o|-o] [option=value]β Set a key-value pair in the options hash When the arg'+o'is given (or the option is preceded by'no') the option is deleted. Can be used to change the ReadLine behaviour independent from the application.asciiβ Output ascii values for the char in the edit line on the cursor position.testchrβ Wait for a character input and output ascii values for it.bindchr chr=keynameβ Map a char (or char sequence) to a key name.bindkey chr=sub { code }β Map a char (or char sequence) to a key name.!,shell shellcodeβ Eval a system command. The'%'character in this string will be replace with the name of a tmp file containing the edit buffer. After execution this tmp file will be read back into the edit buffer. Of course you can use an backslash to escape a literal'%'. Note that this tmp file feature only works if you haveFile::Tempinstalled.eval perlcodeβ Eval some perlcode for the most evil instant hacks. The ReadLine object can be called as$self.alias char=macroβ Define a macro in an alias with a one character name. These can be executed with the'@'command. Non alphanumeric keys like"\n"and"\e"can be inserted with the standard perl escape sequences. You need to use"\\"for a literal'\'.
π ATTRIBS π
you can get at these through the "Attribs" method (defined by the parent class, she provides).
aliasesβ This option is refers to a hash with aliases, used for the key binding for'@'. Note that all aliases have a one character name prefixed with a"_", this is due to historic implementations where the same hash is used for system aliases. We don't support aliases for the shell command, to have that you should define your own shell subroutine (see below).editorβ Editor command used for the'v'binding. The string is run by the shell command. This option defaults to theEDITORenvironment variable or to"vi %".shellβ The value can be set to a CODE ref to handle the shell command from the mini-buffer and the'v'key binding. It should return the exit status of the command (like the perlfunc"system()").
π AUTHOR π
Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
Copyright (c) 2004 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π SEE ALSO π
Term::ReadLine::Zoid
and that's the whole page bestie, you ate π mwah π β this one's from perl v5.34.0, dated 2022-06-17, and the manual name is Term::...Command(3pm). take care of her, she's iconic. β¨π¦
π¦ where this page comes from
- debian bookworm: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libterm-readline-zoid-perl 0.07-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms