0% found this document useful (0 votes)
18 views

Command Mode: U Undo Last Single Change

Vim has two main modes: command mode for issuing commands and insert mode for entering text. Command mode is the default mode and allows movement, editing, and exiting the file using commands like i to insert text or ZZ to write and quit. Text can be cut or copied using visual selection and then pasted elsewhere using the p command.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Command Mode: U Undo Last Single Change

Vim has two main modes: command mode for issuing commands and insert mode for entering text. Command mode is the default mode and allows movement, editing, and exiting the file using commands like i to insert text or ZZ to write and quit. Text can be cut or copied using visual selection and then pasted elsewhere using the p command.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Command Mode

•Command mode is the mode you are in when you start (default mode)

•Command mode is the mode in which commands are given to move around
in the file, to make changes, and to leave the file

Insert (or Text) Mode

•The mode in which text is created. (You must press <enter> at the
end of each line unless you've set wrap margin.)

•There is more than one way to get into insert mode but only one way
to leave: return to command mode by pressing <Esc>

To be in command mode: Esc

ZZ Write (if there were changes), then quit

:wq Write, then quit

:q Quit (will only work if file has not been changed)

:q! Quit without saving changes to file

You must press <enter> after commands that begin with a : (colon)

From Command Mode

i Insert text before current character

a Append text after current character

I Begin text insertion at the beginning of a line

A Append text at end of a line

o Open a new line below current line

O Open a new line above current line

u Undo last single change

U Restore current line

To cut-and-paste or copy-and-paste:

1.Position the cursor at the beginning of the text you want to cut/copy.
2.Press v to begin character-based visual selection, or V to select whole lines,
or Ctrl-v or Ctrl-q to select a block.
3.Move the cursor to the end of the text to be cut/copied. While selecting text,
you can perform searches and other advanced movement.
4.Press d (delete) to cut, or y (yank) to copy.
5.Move the cursor to the desired paste location.
6.Press p to paste after the cursor, or P to paste before.

Visual selection (steps 1-3) can be performed using a mouse.

You might also like