Wednesday, July 25, 2012

Trinary Dwarfs-Using VI



The following are some useful commands to use in the text editor vi.
Note-Editor commands in vi are  case sensitive and the editor removes spaces in text filenames
vi - opens vi text editor
vi filename - opens a file or creates a new file
esc - is used to switch from text insertion mode to command mode
Command mode-:q - is the quit command
:w - is the write/save command, w filename writes to that filename
:wq - writes and quits from vi
:q! exclamation point forces the quit command
:w filename is used to write to another file, save as function
ctrl u/ctrl d is used page up page down, file may open at bottom of page
:11 goes to text line 11
/word seaches for the character string word, while in this mode N goes to the closest word up from current line n goes to the closest word below current line
Cursor controlarrow keys or h j k l can be used to move cursor
0     beginning of line (zero)
$     end of line
W    w     word right
B    b     word left
E    e     end of word right
a goes into insert mode one space right of cursor
A is end line insert
:r filename inserts a file directly below current line
dw deletes forward word
db deletes back word
dd deletes line
Replacement
:%s/\r//
:%s/oldText/newText/g this command will replace instances of one text string with another text string

No comments:

Post a Comment