Vi: Difference between revisions

Content added Content deleted
(wp:Category:Unix text editors / Command-Summary)
m (:wq)
Line 1: Line 1:
[[wp:vi|VI]] (for "visual editor") is a text editor for "plain text".
[[wp:vi|VI]] (for "visual editor") is a text editor for "plain text". <br>
It is the [[wp:Category:Unix text editors|standard-editor]] on most Unix-systems.
It is the [[wp:Category:Unix text editors|standard-editor]] on most Unix-systems.


Line 28: Line 28:
hjkl - move cursor: left/down/up/right (use with count: "5k" move 5 lines up )
hjkl - move cursor: left/down/up/right (use with count: "5k" move 5 lines up )
Cursor-keys should work as well
Cursor-keys should work as well
/abc/ - find text "abc"
/abc - find text "abc"
. - repeat last command (e.g. the last find)
n - find next match


x - delete char ( use with count: "5x" deletes 5 char )
x - delete char ( use with count: "5x" deletes 5 char )
dd - delete line ( dito: "2dd" deletes 2 lines )
dd - delete line ( dito: "2dd" deletes 2 lines )
p - paste: insert previously deleted text at current position
u - undo
u - undo
. - repeat last change-command


: is the prefix for commands:
: is the prefix for commands:

:help - show help-pages
:set ruler - toggle display of current line-number in status-line


:33 - move to line 33
:33 - move to line 33
G - Goto last line ( "33G" goto line 33 )


:r file2.txt - read: insert contents of file2 at current position
:r file2.txt - read: insert contents of file2.txt at current position


:w - write current file ( :w! to force it )
:w - write current file ( :w! to force it )
:q - quit ( :q! to force it )
:q - quit ( :q! to force it. Combined: ":wq!" )
</pre>
</pre>