Term::ReadLine::Zoid::ViCommand - a readline command mode
This class is used as a mode under Term::ReadLine::Zoid, see there for usage details.
This mode provides a "vi command mode" as specified by the posix spec for the sh(1) utility. It intends to include at least all key-bindings mentioned by the posix spec for the vi mode in sh(1). It also contains some extensions borrowed from vim(1) and some private extensions.
This mode has a "kill buffer" that stores the last killed text so it can be yanked again. This buffer has only one value, it isn't a "kill ring".
Since ViCommand inherits from MultiLine, which in turn inherits from Term::ReadLine::Zoid, key bindings are also inherited unless explicitly overloaded.
Control-d is ignored in this mode.
Reset the command mode.
Return the current edit line to the application for execution.
Send a SIGSTOP to the process of the application. Might not work when the application ignores those, which is something shells tend to do.
Switch back to insert mode.
Switch back to insert mode at the begin of the edit line.
Enter insert mode after the current cursor position.
Enter insert mode at the end of the edit line.
Switch to multiline insert mode, see Term::ReadLine::Zoid::MultiLine. (private extension)
Switch to multiline insert mode at the end of the edit buffer. (private extension)
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 (using File::Glob) and insert the largest matching part in the edit line.
Do pathname completion but inserts all matches.
Regard the contents of the alias _char as 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.
Reverse case for count characters.
Repeat the last non-motion command. If no count is specified the original count of the command is used.
Edit the buffer with the editor specified by the
EDITOR environment variable or the editor option,
defaults to 'vi'.
This function requires the File::Temp module from cpan, which in turn needs File::Spec and other packages. If these are not available this functions is disabled.
Move the cursor to the right.
Move the cursor to the left.
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.)
Move the cursor to the end of the current word or bigword.
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.
Move the cursor to the begin of the edit line.
Set the cursor to position count (1-based).
Set cursor to count'th occurrence of char to the right. The cursor is placed on char.
Set cursor to count'th occurrence of char to the left. The cursor is placed on char.
Set cursor to count'th occurrence of char to the right. The cursor is placed before char.
Set cursor to count'th occurrence of char to the left. The cursor is placed after char.
Repeat the last 'f', 'F', 't', or 'T' command. Count of last command is ignored.
Like ';' but with direction reversed.
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.
Delete from cursor to end of line and enter insert mode.
Delete current line and enter insert mode.
Replace the character under the cursor (and the count characters next to it) with char.
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.
Delete count characters and place them in the save buffer.
Delete count characters before the cursor position and place them in the save buffer.
('x' is like 'delete', 'X' like backspace)
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.
Delete from the cursor position until the end of the line and put the deleted part in the save buffer.
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.
Like y but from cursor till end of line.
Insert count copies of the the save buffer after the cursor.
Insert count copies of the the save buffer before the cursor.
Undo the last command that changed the edit line.
Undo all changes.
TODO all changes since when ? since entering the command mode ?
Go count lines backward in history.
Go count lines forward in history.
Go to history entry number number, or to the first history entry.
Repeat the last history search by either the '/' or '?' minibuffers or the incremental search mode.
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.
If cursor is on a number, increment it. (This is a vim extension)
FIXME bit buggy
If cursor is on a number, decrement it. (This is a vim extension)
FIXME bit buggy
These can be used from the ":" mini buffer. Some commands are borrowed from vim, but no guarantee what so ever.
Return undef to the application (like '^D' in insert mode).
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.
Output ascii values for the char in the edit line on the cursor position.
Wait for a character input and output ascii values for it.
Map a char (or char sequence) to a key name.
Map a char (or char sequence) to a key name.
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 have File::Temp installed.
Eval some perlcode for the most evil instant hacks.
The ReadLine object can be called as
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 '\'.
These can be accessed through the
Attribs method (defined by the parent class).
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 command used for the 'v' binding. The string is run by the shell command. This option defaults to the EDITOR enviroment variable or to "vi %".
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
Jaap Karssenberg || Pardus [Larus] <firstname.lastname@example.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.