100% found this document useful (1 vote)
131 views2 pages

Comenzi VI

Vi is a text editor that has both a command mode and an insert mode. In command mode, various keyboard shortcuts allow you to navigate, edit, and manipulate text. Common commands include hjkl to move the cursor, dd to delete a line, u to undo, and ZZ to save and exit. The -x option encrypts files while editing.

Uploaded by

Diana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
131 views2 pages

Comenzi VI

Vi is a text editor that has both a command mode and an insert mode. In command mode, various keyboard shortcuts allow you to navigate, edit, and manipulate text. Common commands include hjkl to move the cursor, dd to delete a line, u to undo, and ZZ to save and exit. The -x option encrypts files while editing.

Uploaded by

Diana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

ABOUT VI

SYNTAX

vi [ -| -s ] [-l] [-L] [-R] [ -r [ filename ] ] [-S] [-t tag] [-v] [-V] [-x] [-w] [-n ] [-C] [+command | -c command ] filename

- | -s Suppress all interactive user feedback. This is useful when processing editor scripts.
-l Set up for editing LISP programs.
-L List the name of all files saved as the result of an editor or system crash.
-R Readonly mode; the readonly flag is set, preventing accidental overwriting of the file.
-r filenameEdit filename after an editor or system crash. (Recovers the version of filename that was in the buffer when the crash occurred.)
-S This option is used in conjunction with the -t tag option to tell vi that the tags file may not be sorted and that, if the binary search (which relies on a sorted
tags file) for tag fails to
find it, the much slower linear search should also be done. Since the linear search is slow, users of large tags files should ensure that the tags files are
sorted rather than use this flag. Creation of tags files normally produces sorted tags files. See ctags for more information on tags files.
-t tag Edit the file containing the tag, tag, and position the editor at its definition.
-v Start up in display editing state using vi . You can achieve the same effect by simply typing the vi command itself.
-V Verbose. When ex commands are read by means of standard input, the input will be echoed to standard error. This may be useful when processing ex
commands within shell scripts.
-x Encryption option; when used, vi simulates the X command of ex and prompts the user for a key. This key is used to encrypt and decrypt text using the
algorithm of the crypt command. The X command makes an educated guess to determine whether text read in is encrypted or not. The temporary buffer
file is encrypted also, using a transformed version of the key typed in for the -x option. If an empty encryption key is entered (that is, if the return key is
pressed right after the prompt), the file will not be encrypted. This is a good way to decrypt a file erroneously encrypted with a mistyped encryption key,
such as a backspace or undo key.
-wn Set the default window size to n. This is useful when using the editor over a slow speed line.
-C Encryption option; same as the -x option, except that vi simulates the C command of ex . The C command is like the X command of ex , except that all text
read in is assumed to have been encrypted.
+command | Begin editing by executing the specified editor
-c command command (usually a search or positioning command).
filename The file to be edited.

USER COMMANDS

Arrow keys Move cursor + next line, at first non-white space character
hjkl Same as arrow keys - previous line, at first non-white space character
itextESC Insert text CR return, same as +
cwnewESC Change word to new down-arrow or next line, same column
j
easESC pluralize word (end of word; append s; escape from input up-arrow or k previous line, same column
state)
x delete a character ^ first non-white space character
dw delete a word 0 beginning of line
dd delete a line $ end of line
3dd deletes 3 lines l or -> forward
u undo previous change h or <- backward
ZZ exit vi , saving changes ^H same as <- (backspace)
:q!CR quit, discarding changes space same as -> (space bar)
/textCR search for text fx find next x
^U ^D scroll up or down Fx find next x
:cmdCR any ex or ed command tx move to character following the next x
ESC end insert or incomplete command Tx move to character following the previous x
DEL (delete or rubout) interrupts ; repeat last f, F, t, or T
:wCR write back changes , repeat inverse of last f, F, t, or T
:w!CR forced write, if permission originally not valid n| move to column n
:qCR quit % find matching ( ) or { }
:q!CR quit, discard changes w forward a word
:e nameCR edit file name b back a word
:e!CR reedit, discard changes e end of word
:e + nameCR edit, starting at end ) to next sentence
:e +nCR edit, starting at line n } to next paragraph
:e #CR edit alternate file ( back a sentence
:e! #CR edit alternate file, discard changes { back a paragraph
:w nameCR write file name W forward a blank-delimited word
:w! nameCR overwrite file name B back a blank-delimited word
:shCR run shell, then return E end of a blank-delimited word
:!cmdCR run cmd, then return ^H erase last character (backspace)
:nCR edit next file in arglist ^W erase last word
:n argsCR specify new arglist erase your erase character, same as ^H (backspace)
^G show current file and line kill your kill character, erase this line of input
:ta tagCR position cursor to tag \ quotes your erase and kill characters
F forward screen ESC ends insertion, back to command mode
^B backward screen CTRL-C interrupt, suspends insert mode
^D scroll down half screen ^D backtab one character; reset left margin of autoindent
^U scroll up half screen ^^D caret (^) followed by control-d (^D); backtab to beginning of line;
do not reset left margin of autoindent
nG go to the beginning of the specified line (end default), 0^D backtab to beginning of line; reset left margin of autoindent
where n is a line number
/pat next line matching pat ^V quote non-printable character
?pat previous line matching pat a append after cursor
n repeat last / or ? command A append at end of line
N reverse last / or ? command i insert before cursor
/pat/+n nth line after pat I insert before first non-blank
?pat?-n nth line before pat o open line below
]] next section/function O open line above
[[ previous section/function rx replace single character with x
( beginning of sentence RtextESC replace characters
) end of sentence d delete
{ beginning of paragraph c change
} end of paragraph y yank lines to buffer
% find matching ( ) or { } > left shift
^L clear and redraw window < right shift
^R clear and redraw window if ^L is -> key ! filter through command
zCR redraw screen with current line at top of window C change rest of line (c$)
z-CR redraw screen with current line at bottom of window D delete rest of line (d$)
z.CR redraw screen with current line at center of window s substitute characters (cl)
/pat/z-CR move pat line to bottom of window S substitute lines (cc)
zn.CR use n-line window J join lines
^E scroll window down one line x delete characters (dl)
^Y scroll window up one line X delete characters before cursor dh)
`` move cursor to previous context Y yank lines (yy)
'' move cursor to first non-white space in line 3yy yank 3 lines
mx mark current position with the ASCII lower-case letter x 3yl yank 3 characters
`x move cursor to mark x p put back text after cursor
'x move cursor to first non-white space in line marked by x P put back text before cursor " .nr )I xp"n
put from buffer x " .nr )I xy"n
yank to buffer x " .nr )I xd"n
delete into buffer x
H top line on screen u undo last change
L last line on screen U restore current line
M middle line on screen . repeat last change " .nr )I dp"n
retrieve d'th last delete

You might also like