Term::ReadLine::Zoid::ViCommand(3) a readline command mode

DESCRIPTION

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''.

KEY MAPPING

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.

escape
Reset the command mode.
return
^J
Return the current edit line to the application for execution.
^Z
Send a SIGSTOP to 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, see Term::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 (using File::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 _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.

[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 the File::Temp module from cpan, which in turn needs File::Spec and 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