Content added Content deleted
imported>mutante m (Replacing page with '<jargon />') |
imported>mutante mNo edit summary |
||
Line 1: | Line 1: | ||
http://www.friedhoff.org/img/viemacspolice.png |
|||
One of / The most popular [[console]] [[text editors]] in [[Unix]] / [[Linux]]. |
|||
*i edit befor cursor |
|||
*a edit after cursor |
|||
*o edit new line befor cursor |
|||
*O edit new line after cursor |
|||
*r replace char |
|||
*cw change word |
|||
*dw delete word |
|||
*x delete |
|||
*7x dlete 7 chars |
|||
*dd delete line |
|||
*:w write file |
|||
*:wq write quit |
|||
*:q! force quit |
|||
*[Ctrl]+ ZZ quit writing if needed |
|||
Use / [string] to search ( n for next) |
|||
Use [Ctrl+V] to enter escape codes |
|||
Ie. [Ctrl+V] [backspace] makes a ^H (ie to use in .profile when you do a stty erase ^H) |
|||
---- |
|||
<pre> |
|||
Character |
|||
h, j, k, l Left, down, up, right (, , , ) |
|||
Text |
|||
w, W, b, B Forward, backward by word |
|||
e , E End of word |
|||
), ( Beginning of next, previous sentence |
|||
}, { Beginning of next, previous paragraph |
|||
]], [[ Beginning of next, previous section |
|||
Lines |
|||
0, $ First, last position of current line |
|||
^ First character of current line (ignore spaces) |
|||
+, - First character of next, previous line |
|||
n| Column n of current line |
|||
H Top line of screen |
|||
M Middle line of screen |
|||
L Last line of screen |
|||
nH n (number) of lines after top line |
|||
nL n (number) of lines before last line |
|||
Screens |
|||
[CTRL-F], [CTRL-B] Scroll forward, backward one screen |
|||
[CTRL-D] [CTRL-U] Scroll down, up one-half screen |
|||
[CTRL-E] [CTRL-Y] Show one more line at bottom, top of window |
|||
z [RETURN] Reposition line with cursor: to top of screen |
|||
z. Reposition line with cursor: to middle of screen |
|||
z- Reposition line with cursor: to bottom of screen |
|||
[CTRL-L] [CTRL-R] Redraw screen (without scrolling) |
|||
Searches |
|||
/pattern Search forward for pattern |
|||
?pattern Search backward for pattern |
|||
n, N Repeat last search in same, opposite direction |
|||
/, ? Repeat previous search forward, backward |
|||
fx Search forward for character x in current line |
|||
Fx Search backward for character x in current line |
|||
tx Search forward for character before x in current line |
|||
Tx Search backward for character after x in current line |
|||
; Repeat previous current-line search |
|||
' Repeat previous current-line search in opposite direction |
|||
Line number |
|||
[CTRL-G] Display current line number |
|||
nG Move to line number n |
|||
G Move to last line in file |
|||
:n Move to line number n |
|||
Marking position |
|||
mx Mark current position as x |
|||
`x Move cursor to x |
|||
`` Return to previous mark or context |
|||
'x Move to beginning of line containing mark x |
|||
'' Return to beginning of line containing previous mark |
|||
Insert |
|||
i, a Insert text before, after cursor |
|||
I, A Insert text at beginning, end of line |
|||
o, O Open new line for text below, above cursor |
|||
Change |
|||
r Change character |
|||
cw Change word |
|||
cc Change current line |
|||
C Change to end of line |
|||
R Type over characters |
|||
s Delete character and substitute text |
|||
S Delete current line and substitute text |
|||
Delete, move |
|||
x Delete character |
|||
X Delete character before cursor |
|||
dw Delete word |
|||
dd Delete current line |
|||
D Delete to end of line |
|||
p, P Put deleted text after, before cursor |
|||
"np Put text from delete buffer number n after cursor (for last nine deletions) |
|||
Yank |
|||
yw Yank (copy) word |
|||
yy Yank current line |
|||
"ayy Yank current line into named buffer a |
|||
p, P Put yanked text after, before cursor |
|||
"aP Put text from buffer a before cursor |
|||
Other commands |
|||
. Repeat last edit command |
|||
u, U Undo last edit; restore current line |
|||
J Join two lines |
|||
ex edit commands |
|||
:d Delete lines |
|||
:m Move lines |
|||
:co or :t Copy lines |
|||
:.,$d Delete from current line to end of file |
|||
:30,60m0 Move lines 30 through 60 to top of file |
|||
:.,/pattern/co$ Copy from current line through line containing pattern to end of file |
|||
Exit Commands |
|||
ZZ Write (save) and quit file |
|||
:x Write (save) and quit file |
|||
:wq Write (save) and quit file |
|||
:w Write (save) file |
|||
:w! Write (save) file (overriding protection) |
|||
:30,60w newfile Write from line 30 through line 60 as newfile |
|||
:30,60w>> file Write from line 30 through line 60 and append to file |
|||
:w %.new Write current buffer named file as file.new |
|||
:q Quit file |
|||
:q! Quit file (overriding protection) |
|||
Q Quit vi and invoke ex |
|||
:e file2 Edit file2 without leaving vi |
|||
:n Edit next file |
|||
:e! Return to version of current file at time of last write (save) |
|||
:e# Edit alternate file |
|||
% Current filename |
|||
# Alternate filename |
|||
Command Line Options |
|||
vi file Invoke vi editor on file |
|||
vi file1 file2 Invoke vi editor on files sequentially |
|||
view file Invoke vi editor on file in read-only mode |
|||
vi -R file Invoke vi editor on file in read-only mode |
|||
vi -r file Recover file and recent edits after system crash |
|||
vi + file Open file at last line |
|||
vi +n file Open file directly at line number n |
|||
vi +/pattern file Open file directly at pattern |
|||
ex file Invoke ex editor on file from UNIX |
|||
</pre> |
|||
=== lol === |
|||
~$ vi |
|||
? |
|||
File empty: Nothing to search |
|||
help |
|||
The default buffer ist empty |
|||
Alt-Q |
|||
q isn't a vi command |
|||
Ctrl-Q |
|||
alt-x |
|||
alt-F4 |
|||
q |
|||
q isn't a vi command |
|||
ESC |
|||
F10 |
|||
*reset knopf drück* |
|||
:q! (ohne speichern raus) |
|||
=== VI cursor keys bug , ABCD instead of arrows === |
|||
If it happens to you that the cursor keys dont seem to work in Insert Mode anymore, but instead they insert the characters A,B,C and D, then use ''':set term=cons25''' and read here http://www.vim.org/tips/tip.php?tip_id=550 |
|||
<jargon /> |
<jargon /> |
||
[[Category:Programs]] |
|||
[[Category:Unix]] |
|||
[[Category:Computer]] |
|||
[[Category:Linux]] |
|||
[[Category:Manpages]] |
Revision as of 07:10, 14 November 2007
http://www.friedhoff.org/img/viemacspolice.png
One of / The most popular console text editors in Unix / Linux.
- i edit befor cursor
- a edit after cursor
- o edit new line befor cursor
- O edit new line after cursor
- r replace char
- cw change word
- dw delete word
- x delete
- 7x dlete 7 chars
- dd delete line
- w write file
- wq write quit
- q! force quit
- [Ctrl]+ ZZ quit writing if needed
Use / [string] to search ( n for next)
Use [Ctrl+V] to enter escape codes Ie. [Ctrl+V] [backspace] makes a ^H (ie to use in .profile when you do a stty erase ^H)
Character h, j, k, l Left, down, up, right (, , , ) Text w, W, b, B Forward, backward by word e , E End of word ), ( Beginning of next, previous sentence }, { Beginning of next, previous paragraph ]], [[ Beginning of next, previous section Lines 0, $ First, last position of current line ^ First character of current line (ignore spaces) +, - First character of next, previous line n| Column n of current line H Top line of screen M Middle line of screen L Last line of screen nH n (number) of lines after top line nL n (number) of lines before last line Screens [CTRL-F], [CTRL-B] Scroll forward, backward one screen [CTRL-D] [CTRL-U] Scroll down, up one-half screen [CTRL-E] [CTRL-Y] Show one more line at bottom, top of window z [RETURN] Reposition line with cursor: to top of screen z. Reposition line with cursor: to middle of screen z- Reposition line with cursor: to bottom of screen [CTRL-L] [CTRL-R] Redraw screen (without scrolling) Searches /pattern Search forward for pattern ?pattern Search backward for pattern n, N Repeat last search in same, opposite direction /, ? Repeat previous search forward, backward fx Search forward for character x in current line Fx Search backward for character x in current line tx Search forward for character before x in current line Tx Search backward for character after x in current line ; Repeat previous current-line search ' Repeat previous current-line search in opposite direction Line number [CTRL-G] Display current line number nG Move to line number n G Move to last line in file :n Move to line number n Marking position mx Mark current position as x `x Move cursor to x `` Return to previous mark or context 'x Move to beginning of line containing mark x '' Return to beginning of line containing previous mark Insert i, a Insert text before, after cursor I, A Insert text at beginning, end of line o, O Open new line for text below, above cursor Change r Change character cw Change word cc Change current line C Change to end of line R Type over characters s Delete character and substitute text S Delete current line and substitute text Delete, move x Delete character X Delete character before cursor dw Delete word dd Delete current line D Delete to end of line p, P Put deleted text after, before cursor "np Put text from delete buffer number n after cursor (for last nine deletions) Yank yw Yank (copy) word yy Yank current line "ayy Yank current line into named buffer a p, P Put yanked text after, before cursor "aP Put text from buffer a before cursor Other commands . Repeat last edit command u, U Undo last edit; restore current line J Join two lines ex edit commands :d Delete lines :m Move lines :co or :t Copy lines :.,$d Delete from current line to end of file :30,60m0 Move lines 30 through 60 to top of file :.,/pattern/co$ Copy from current line through line containing pattern to end of file Exit Commands ZZ Write (save) and quit file :x Write (save) and quit file :wq Write (save) and quit file :w Write (save) file :w! Write (save) file (overriding protection) :30,60w newfile Write from line 30 through line 60 as newfile :30,60w>> file Write from line 30 through line 60 and append to file :w %.new Write current buffer named file as file.new :q Quit file :q! Quit file (overriding protection) Q Quit vi and invoke ex :e file2 Edit file2 without leaving vi :n Edit next file :e! Return to version of current file at time of last write (save) :e# Edit alternate file % Current filename # Alternate filename Command Line Options vi file Invoke vi editor on file vi file1 file2 Invoke vi editor on files sequentially view file Invoke vi editor on file in read-only mode vi -R file Invoke vi editor on file in read-only mode vi -r file Recover file and recent edits after system crash vi + file Open file at last line vi +n file Open file directly at line number n vi +/pattern file Open file directly at pattern ex file Invoke ex editor on file from UNIX
lol
~$ vi ? File empty: Nothing to search help The default buffer ist empty Alt-Q q isn't a vi command Ctrl-Q alt-x alt-F4 q q isn't a vi command ESC F10 *reset knopf drück*
:q! (ohne speichern raus)
VI cursor keys bug , ABCD instead of arrows
If it happens to you that the cursor keys dont seem to work in Insert Mode anymore, but instead they insert the characters A,B,C and D, then use :set term=cons25 and read here http://www.vim.org/tips/tip.php?tip_id=550
<jargon />