Anonymous user
Vi: Difference between revisions
m
Category:Vim Script
m (:wq) |
m (Category:Vim Script) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2:
It is the [[wp:Category:Unix text editors|standard-editor]] on most Unix-systems.
The current versions have almost everything you can expect from an modern editor: <br>
scripting, macro-recording, tags, syntax-coloring, UTF-8, Unicode, GUI etc.
However, the basic concept is quite old, e.g. it also has an '''ex'''-mode <br>▼
▲However, the basic concept is quite old, e.g. it also has an '''ex'''-mode
▲that was designed to work with old teletype-devices.
There are several variants:
* [[BusyBox]] - includes a tiny vi clone
* [[wp:Elvis (text editor)|Elvis]]
* [[wp:nvi|nvi]] - "new vi"
* [[wp:vile (editor)|vile]] - "VI Like Emacs"
* [[wp:Vim (text editor)|vim]] - "
** current version: Vim 7.4.507 (2013-07)
** See also [[:Category:Vim Script]]
==VI-Quickreference==
'''Usage:''' vi file.txt
The bottom screen-row is used as a statusline, and for entering commands.
There is a "normal" mode that acts as command-mode, and an insert-mode:
<pre>
i - insert text at cursor-position
a - append text at end-of-line
ESC - abort command, i.e. end insert-mode, and return to normal/commandmode.
w b - move cursor one word forward/backward ( "3w" moves 5 words forward )
/abc - find text "abc"▼
n - find next match▼
▲/abc - find text "abc"
▲n - find next match
x - delete
dd - delete line (
p P - paste: insert previously deleted text at/before the current position
u - undo
r R - replace single char / enter Replace-mode (like insert, but overwrites)
. - repeat last change-command
: is the prefix for commands:
:help - show help-pages
:set ruler - toggle display of current line-number in status-line
:r file2.txt - read: insert contents of file2.txt at current position▼
:33 - move to line 33▼
▲G - Goto last line ( "33G" goto line 33 )
▲:33 - move to line 33
▲:r file2.txt - read: insert contents of file2.txt at current position
:2,5s/old/new/ - substitute: in lines 2..5 replace "old" with "new"
:w - write current file ( :w! to force it )▼
:q - quit ( :q! to force it. Combined: ":wq!" )▼
▲:w - write current file ( :w! to force it )
▲:q - quit ( :q! to force it. Combined: ":wq!" )
</pre>
<small>( Also, look for "vi reference mug" :)</small>
[[Category:Editor]]
|