Beruflich Dokumente
Kultur Dokumente
Introduction to vi
The vi Editor
υ Modes of Operation
ESC :
Basic
Command mode - Moving the Cursor
(Loading and Saving files)
υ vi [filename] - start vi ( edit filename) υ l,h,j,k - move right, left, down, up
υ vi +[number, /string] - begin with start line, first υ w,b,e - move right one, left one, to end of word
matching string, relatively υ W,B,E - equivalent above except the space delimited
υ :e filename - edit filename word
υ :q - terminate vi without saving υ -,Enter - move start of upper line, start of next line
υ :q! - terminate vi, leave file unchanged υ ^,$ - move start of line, end of line
υ :w - save edited file, stay in vi υ <crtl>+u,d,b,f - move screen one half-page up, one
υ :r filename - read in text in filename half page down, one page up, one page down in text
υ H,M,L - move left end of top, middle line, bottom line
υ G - move to last line
υ nG - move to nth line
1
Command mode - Changing text Searching for a String
υ The Search Commands
υ cw - change to end of word
/xxx - search forward for text string xxx
υ cb - change to begin of word
?xxx - search backward for text string xxx
υ cW - change to end of space delimited word / - repeat search forwards
υ cB - change to begin of space delimited word ? - repeat search backwards
υ cc - change the current line n - repeat search in same direction
N - repeat search in opposite direction
υ Special Characters in Search Strings
^ - the beginning-of-line indicator
$ - the end-of-line indicator
. - the any character indicator
\> - the end-of-word indicator
\< - the beginning-of-word indicator
[ ] - the character class definition
The Put, Delete and Yank Commands Reading and Writing Files
υ The General Purpose Buffer υ Read Command
Store the text that you most recently changed, deleted and :[address]r [filename]
yanked. υ Write Command
Undo command uses the general purpose buffer when it
:[address]w[!] [filename] - overwrite mode
restores text
:[address]w>>filename - append mode
υ y - yank command address - the same as substitution command
yy, Y - yank the current line
nyy, nY - yank the n line from current line
υ p - paste the text on a new line after the current line
υ P - paste the text on a new line above the current line
2
Setting Parameters Setting Parameters
υ Setting Parameters in a Startup File υ Parameters (Cont.)
Bourne and Korn shell - .profile
Shell[=pathname]
EXINIT = ‘set param1 param2 …’
showmode, noshowmode - give a cue to let you know when
export EXINIT
vi is in Input Mode
C shell - .login
flash, noflash - beep when give invalid command or press
setenv EXINIT = ‘set param1 param2 …’
<ESC> in Command Mode
.exrc
ignorecase, noignorecase - ignore case in search
set param1 param2 …
magic, nomagic - special characters in search strings have
υ Parameters no special meanings (except ^, $)
:set all - show all parameter list, nolist - show <TAB> -> ^I, end of line -> $
number, nonumber - show line number, hide line number wrapscan, nowrapscan
wrapmargin=nn - break the line by inserting <newline> autoindent, noautoindent
character at the closest blank delimited word boundary shiftwidth=nn
λ nn - the number of character from the right side of the screen
Units of Measure
υ Character
υ Word - <space>, <tab>,<newline>, numeral,
punctuation marks
υ Line - <newline>
υ Sentence - period, exclamation point, question mark,
followed by two <space> or a <newline>
υ Paragraph - blank line
υ Screen