- Mitglied seit
- 14 Okt 2004
- Beiträge
- 1,305
- Punkte für Reaktionen
- 0
- Punkte
- 36
Wurde in einem anderen Thread gefragt...
Achtung:
Note:
Einziger Notausgang bei nvi: Stecker ziehen !!
Only possible emergency action: unplug the power !
Notausgang bei vi: zweimal "<esc>" dann :q! sollte immer gehen.
Im Zweifelsfall immer machen und neu editieren.
Vi reagiert manchmal "allergisch" auf Cursor oder sonstige Tasten !
Hab die Bedienung von vi nur in "english" in einer alten Mail gefunden.
vi has 2 modes:
- command mode
- editing mode
Advantage of vi: is at every UNIX available ( default: installed )
Some samples of commands in command mode:
i => insert at current position
x => delete character below cursor
cw => change word ( word ends at "not normal character )
After word changed => press <ESC> => normal command mode
o => open new line below current line
O => open new line above current line
Y => take line to buffer ( 12Y => take next 12 lines to buffer )
P => put buffer above current line
p => put buffer below current line
dd => delete current lint
dw => delete word
/<string> => look forward for <string>
/ => look again
?<string> => look backwards for string
? => look backwards for last search
C => change rest of the line ( finish with <ESC> )
D => delete rest of the line
A => append to end of line
a => append after current character
<address>G => go to line <address>
1G => go to beginning of file
$G => go to last line
<ctrl>f => go to next page
<ctrl>b => go to previous page
: => go to command line
At command line:
w => write file
q => quit
q! => quit if you did changes and do not want to save
%s/string/replace/g => replace at whole file "string" with "replace"
12,16s/string/replace/ => replace from line 12 to 16 ( no "g" only first in a line is replaces )
f => show file name and position
e! => read file again ( discard changes )
set list => show tabs as "^I" and line end as "$"
set nolist => turn set list off
Edit: deutlichere nvi-Warnung, add some more translation
Achtung:
- Es ist einfach die Box mit vi "tot zu legen".
Mit nvi geht es noch schneller ! nvi überschreibt auch, wenn man nichts geändert hat.
Einzige "Abbruchmöglichkeit": noch während nvi gestartet ist "Stecker" ziehen. - Für die "Text" Dateien unter /var/flash/ auf der Box kann man "nvi <file>" nutzen.
nvi kopiert die Dateien aus dem Flash passend um. - Nie Dateien unter /proc/* mit vi oder nvi editieren. Er sei den ihr wollt einen Briefbeschwerer
- Nicht alle Befehle sind in der Box verfügbar !
Note:
- It's very easy to corrupt the box with vi.
It's even faster possible with nvi ! nvi overwrites values also if you did not do any changes.
Only way to stop this: unplug the power _during_ the start of nvi. - You can use nvi to edit the text files at /var/flash/
nvi copies the file from flash to /var/tmp/, edit them with vi and
is writing the files back indepentand of the changes. - Never edit files of /proc/* with vi or nvi. Except you want to create a paperweight.
- Not all commands of vi are available. It's a busybox vi.
Einziger Notausgang bei nvi: Stecker ziehen !!
Only possible emergency action: unplug the power !
Notausgang bei vi: zweimal "<esc>" dann :q! sollte immer gehen.
Im Zweifelsfall immer machen und neu editieren.
Vi reagiert manchmal "allergisch" auf Cursor oder sonstige Tasten !
Hab die Bedienung von vi nur in "english" in einer alten Mail gefunden.
vi has 2 modes:
- command mode
- editing mode
Advantage of vi: is at every UNIX available ( default: installed )
- normally you are in the command mode
=> nearly each single character does an action
=> very confusing if you press key
- back from editing mode to command mode
<ESC> ( sometime two times )
=> can give critical situation with "cursor" or function keys.
=> Works only proper if varialbe "TERM" is set right
=> can also fail for modem lines, because of "timing"
Cause:
A function key is a "multiple key" like <ESC>[A
=> press key => <ESC> switch to "command mode"
=> [A is interpreted as a command ..
=> oops situation
Some samples of commands in command mode:
i => insert at current position
x => delete character below cursor
cw => change word ( word ends at "not normal character )
After word changed => press <ESC> => normal command mode
o => open new line below current line
O => open new line above current line
Y => take line to buffer ( 12Y => take next 12 lines to buffer )
P => put buffer above current line
p => put buffer below current line
dd => delete current lint
dw => delete word
/<string> => look forward for <string>
/ => look again
?<string> => look backwards for string
? => look backwards for last search
C => change rest of the line ( finish with <ESC> )
D => delete rest of the line
A => append to end of line
a => append after current character
<address>G => go to line <address>
1G => go to beginning of file
$G => go to last line
<ctrl>f => go to next page
<ctrl>b => go to previous page
: => go to command line
At command line:
w => write file
q => quit
q! => quit if you did changes and do not want to save
%s/string/replace/g => replace at whole file "string" with "replace"
12,16s/string/replace/ => replace from line 12 to 16 ( no "g" only first in a line is replaces )
f => show file name and position
e! => read file again ( discard changes )
set list => show tabs as "^I" and line end as "$"
set nolist => turn set list off
Edit: deutlichere nvi-Warnung, add some more translation