Vi: Difference between revisions
Content added Content deleted
m (:2,5s/old/new/) |
m (Category:Vim Script) |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
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. |
||
The current versions have almost everything you can expect from an editor: <br> |
The current versions have almost everything you can expect from an modern editor: <br> |
||
scripting, macro-recording, syntax-coloring, UTF-8, Unicode, GUI etc. |
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 <br> |
||
Line 10: | Line 10: | ||
There are several variants: |
There are several variants: |
||
* [[BusyBox]] |
* [[BusyBox]] - includes a tiny vi clone |
||
* [[wp:Elvis (text editor)|Elvis]] |
* [[wp:Elvis (text editor)|Elvis]] |
||
* [[wp:nvi|nvi]] |
* [[wp:nvi|nvi]] - "new vi" |
||
* [[wp:vile (editor)|vile]] |
* [[wp:vile (editor)|vile]] - "VI Like Emacs" |
||
* [[wp:Vim (text editor)|vim]] |
* [[wp:Vim (text editor)|vim]] - "VI-Improved" Website: [http://www.vim.org vim.org] |
||
** current version: Vim 7.4.507 (2013-07) |
|||
** See also [[:Category:Vim Script]] |
|||
==VI-Quickreference== |
|||
==Command-Summary== |
|||
'''Usage:''' vi file.txt |
'''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: |
There is a "normal" mode that acts as command-mode, and an insert-mode: |
||
Line 27: | Line 31: | ||
ESC - abort command, i.e. end insert-mode, and return to normal/commandmode. |
ESC - abort command, i.e. end insert-mode, and return to normal/commandmode. |
||
h j k l - move cursor: left/down/up/right (use with count: "5k" |
h j k l - move cursor: left/down/up/right ( use with count: "5k" moves 5 lines up ) |
||
The cursor-keys should work as well |
|||
w b - move cursor one word forward |
w b - move cursor one word forward/backward ( "3w" moves 5 words forward ) |
||
G - Goto last line |
G - Goto last line ( "33G" goto line 33 ) |
||
/abc - find text "abc" |
/abc - find text "abc" |
||
n - find next match |
n - find next match |
||
x - delete character |
x - delete character ( use with count: "5x" deletes 5 char ) |
||
dd - delete line |
dd - delete line ( use with count: "2dd" deletes 2 lines ) |
||
p |
p P - paste: insert previously deleted text at/before the current position |
||
u - undo |
u - undo |
||
r R - replace single char / enter Replace-mode (like insert, but overwrites) |
r R - replace single char / enter Replace-mode (like insert, but overwrites) |
||
Line 43: | Line 47: | ||
: is the prefix for commands: |
: is the prefix for commands: |
||
:help - show help-pages |
:help - show help-pages |
||
:set ruler - toggle display of current line-number in status-line |
:set ruler - toggle display of current line-number in status-line |
||
:r file2.txt - read: insert contents of file2.txt at current position |
:r file2.txt - read: insert contents of file2.txt at current position |
||
Line 55: | Line 59: | ||
:q - quit ( :q! to force it. Combined: ":wq!" ) |
:q - quit ( :q! to force it. Combined: ":wq!" ) |
||
</pre> |
</pre> |
||
<small>( Also, look for "vi reference mug" :)</small> |
|||
[[Category:Editor]] |
[[Category:Editor]] |
Latest revision as of 13:21, 11 November 2014
VI (for "visual editor") is a text editor for "plain text".
It is the standard-editor on most Unix-systems.
The current versions have almost everything you can expect from an modern editor:
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
that was designed to work with old teletype-devices.
There are several variants:
- BusyBox - includes a tiny vi clone
- Elvis
- nvi - "new vi"
- vile - "VI Like Emacs"
- vim - "VI-Improved" Website: vim.org
- 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:
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. h j k l - move cursor: left/down/up/right ( use with count: "5k" moves 5 lines up ) The cursor-keys should work as well w b - move cursor one word forward/backward ( "3w" moves 5 words forward ) G - Goto last line ( "33G" goto line 33 ) /abc - find text "abc" n - find next match x - delete character ( use with count: "5x" deletes 5 char ) dd - delete line ( use with count: "2dd" deletes 2 lines ) 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 :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!" )
( Also, look for "vi reference mug" :)