The VI Input Mode |
Prev | Next |
Table of Contents
The goal of the VI mode is not to be a complete replacement for Vim and support all Vim’s features. Its aim is to make the “Vim way” of text editing - and the Vim habits learned - available for programs using the Kate text editor as their internal editor.
The VI mode aims integrate nicely with the programs and deviate
from Vim’s behavior where it makes sense. For example,
:w
will open a save dialog in Kate’s VI mode.
To enable the VI input mode for all new views, go to → + → . On this tab you can set options for the VI Input Mode and define and edit the key mapping in this mode. VI Input Mode can also be toggled with the setting in the menu. (The default shortcut key is Meta+Ctrl+V - where Meta usually is the Windows key).
Many Vi Mode keyboard commands are case-sensitive, unlike most KDE
keyboard shortcuts. That means that y
and
Y
are different commands. To enter the
y
(yank) command, make sure Caps Lock is
disabled and press Y. To enter the Y
(yank to end of line) command,
Shift+Y.
This does not apply to commands that use the Ctrl key, which may be
entered regardless of Caps Lock mode and without pressing
Shift. However, some commands require the use of Ctrl-key combination
followed by another key which is case sensitive. For instance, to input
“Ctrl+W,
h
” (switch to split view right) make sure
Caps Lock is disabled, press
Ctrl+W, release, and
then press H.
There are only a few features of Kate’s VI mode which are incompatible with Vim (not counting things missing). They are listed below together with the respective reasons.
Kate: U
and
Ctrl+R is redo.
Vim: Ctrl+R is normal redo, U is used to undo all latest changes on one line.
The reason for having U act as redo in Kate’s VI mode is
that the shortcut Ctrl+R
by default is taken by Kate’s replace function (search and replace). By default,
the VI mode won’t override Kate’s shortcuts (this can be configured in
→ + → ),
therefore a redo-action needs to be available as a “regular” key press, too.
Besides, the behavior of the U
command in Vim does not map well
to Kate’s internal undo system, so it would be non-trivial to support anyway.
Kate: print
shows the Print dialog.
Vim: print
prints the lines of
the given range like its grandfather ed.
Commands like :print
are available
not only in the VI mode but for users using “regular” Kate, too - therefore
the :print
command opens
the print dialog - following the principle of least surprise instead of
mimicking Vim’s behavior.
Kate: Y
yanks to end of line.
Vim: Y
yanks whole line, just like
y
y
.
VI’s behavior for the Y
command is in practice a bug.
For both change and delete commands,
c
c
/
d
d
will do its action on
the current line and C
/D
will work from the
cursor column to the end of the line. However, both
y
y
and Y
yanks the current line. In Kate’s VI Mode Y
will yank to the end
of the line. This is described as “more logical” in the Vim
documentation.
Kate: O
and o
opens [count
] new lines
and puts you in insert mode.
Vim: O
and o
opens a new line and inserts
text [count
] times when leaving insert mode.
This is mostly done as a consequence of witnessing many people being confused by this behavior on a vim irc channel (#vim on freenode).
Normal Mode permits you to enter commands to navigate or edit a document, and is the default mode. You can return to it from any other mode by pressing Esc.
Visual Mode permits you to highlight text in a document.
Most Normal Mode commands are also valid in this mode. You can enter it by pressing
v
to select characters or V
to select lines.
Insert Mode permits you to edit the document directly. You
can enter it by pressing i
or one of several other commands
listed below.
Command Mode invokes Kate's command line, permitting you to run many commands available in Vi implementations as well as some specific to Kate. For more information on these commands, see the section called “The Editor Component Command Line”. To use it, press :, enter the command, and press Enter.
Visual Mode is entered automatically when text is selected with the mouse. It is also entered when using functions of Kate that select text, such as Select All (either from the menu or via Ctrl+A.)
Vi marks and Kate bookmarks are integrated. When a mark is created in Vi Mode, a corresponding Kate bookmark is created and appears in the menu. Conversely, when a Kate bookmark is created, a corresponding Vi mark at the 0 column is also created.
| Enter Insert Mode; append after cursor |
| Enter Insert Mode; append after line |
| Enter Insert Mode; insert before cursor |
| Enter Visual Mode; select characters |
| Enter Visual Mode; select lines |
| Open a new line below current line |
| Open a new line above current line |
| Join lines |
| Change: follow by a motion to delete and enter Insert mode |
| Change to end of line: Delete to end of line and enter Insert Mode |
| Change line: Delete line and enter Insert Mode |
| Substitute character |
| Substitute line |
| Delete line |
| Follow by a motion to delete |
| Delete to end of line |
| Delete character to right of cursor |
| Delete character to left of cursor |
| Follow with a motion to make lowercase |
| Make the current line lowercase |
| Follow with a motion to make uppercase |
| Make the current line uppercase |
| Follow by a motion to “yank” (copy) |
| Yank (copy) line |
| Yank (copy) line |
| Paste after cursor |
| Paste before cursor |
| Follow with a character to replace the character after the cursor |
| Enter Command Mode |
| Search |
| Undo |
Ctrl+R | Redo |
| Redo |
| Set mark (can be used by motions later) |
| Find next |
| Find previous |
| Indent line |
| Unindent line |
| Indent lines |
| Unindent lines |
Ctrl+F | Page down |
Ctrl+B | Page up |
| Print the ASCII value of the character |
| Repeat last change |
| commandAlignLine |
| commandAlignLines |
| Change case of current character |
Ctrl+S | Split view horizontally |
Ctrl+V | Split view vertically |
Ctrl+W, | Cycle to next split window |
Ctrl+W, Ctrl+W Left | Go to left split window |
Ctrl+W, Ctrl+W Right | Go to right split window |
Ctrl+W, Ctrl+W Up | Go to above split window |
Ctrl+W, Ctrl+W Down | Go to below split window |
These may be used to move around a document in Normal or Visual mode, or in conjunction with one of the above commands. They may be preceded by a count, which indicates how many of the appropriate movements to make.
| Left |
Left | Left |
Backspace | Left |
| Down |
Down | Down |
| Up |
Up | Up |
| Right |
Right | Right |
Space | Right |
| End of line |
End | End of line |
| First character of line (Column 0) |
Home | First character of line |
| First non-blank character of line |
| Follow by character to move to right of cursor |
| Follow by character to move to left of cursor |
| Follow by character to move to right of cursor, placing the cursor on character before it |
| Follow by character to move to left of cursor, placing the cursor on character before it |
| First line |
| Last line |
| Next Word |
| Next word separated by whitespace |
| Previous word |
| Previous word separated by whitespace |
| End of word |
| End of word separated by whitespace |
| End of previous word |
| End of previous word separated by whitespace |
| Follow by a column number to move to that column |
| Follow by an item to move to that item |
| Mark |
| First non-whitespace character of the line the mark is on |
| Previous opening bracket |
| Next opening bracket |
| Previous closing bracket |
| Next closing bracket |
Ctrl+I | Jump forward to next location |
Ctrl+O | Jump back to previous location |
| Go to first line of screen |
| Go to middle line of screen |
| Go to last line of screen |
| Go to specified percentage of the document |
| Go one line up visually (when using dynamic word wrap) |
| Go one line down visually (when using dynamic word wrap) |
These may be used to select certain portions of a document.
| Inner word: word including whitespace |
| A word: word excluding whitespace |
| Previous double-quote ( |
| Previous double-quote ( |
| Previous single-quote ( |
| Previous single-quote ( |
| Previous opening parenthesis [ |
| Previous opening parenthesis [ |
| Previous opening square bracket ( |
| Previous opening square bracket ( |
| Previous opening curly bracket ( |
| Previous opening curly bracket ( |
| Previous opening angle bracket ( |
| Previous opening angle bracket ( |
| Previous backtick ( |
| Previous backtick ( |
Ctrl+D | Unindent |
Ctrl+T | Indent |
Ctrl+E | commandInsertFromBelow |
Ctrl+Y | Delete word |
Ctrl+W | Delete word |
Ctrl+Home | Move to first character in the document |
Ctrl+R
| Insert the contents of register n |
Ctrl+O,
| Enter normal mode for one command only |
Ctrl+A | Increment currently selected number |
Ctrl+X | Decrement currently selected number |
This object is missing in Vim. The comma text object makes it easy to modify parameter lists in C-like languages and other comma separated lists. It is basically the area between two commas or between a comma and a bracket. In the line shown in the illustration to the right, the three ranges this text object can span are highlighted in red.
As stated earlier, the goal of Kate’s VI Mode is not to support 100% of Vim’s features, however, there are some features which are sorely missed:
Visual block mode - especially the ability to prepend/append text to the visual block selection.
Having ex commands available in other programs than the Kate application.
The search code needs improvement and the *
and
#
commands should just be regular searches.
Prev | Contents | Next |
Pâté Python Plugins | Up | Menu Entries |