Gvim Primer (1)--Three basic modes

Source: Internet
Author: User

Because I want to change the IDE for Python, a few tangled, then started vim for Windows, that is, Gvim. First into the Gvim, climbed a lot of pits, like an open gvim do not know how to edit, like a fool. After two days of research, finally have a preliminary understanding of gvim, in this summary of the basic knowledge of the entry Gvim, but also hope to provide a little help to those in need.

Gvim Basic Mode Overview:

Command mode (1) What is called Command mode:

Like a DOS command, input is not supported in command mode, only commands can be typed, and Gvim execute commands. such as cursor movement, copy and paste, and so on command. These commands can be used directly in the traditional editor, but only in command mode in Gvim.

(2) Command mode common commands:
Command Executive Function
H Move left
J Move Down
K Move Up
L Move right
Yy|2yy Copy rows
Dd|2dd Delete a row or cut a row
P (lowercase) Paste to Next line
P (uppercase) Paste to Previous line
^|$ Navigate to the beginning or end of a line
Dg Delete from current line to last line of document
(3) Command mode attachment: Replacement mode
Command Executive Function
R Replace a single character
R Replace multiple characters
U Undo Last Action
Ctrl+y Redo Last Action
Input mode (1) What is called input mode:

Usually a text editor, such as Notepad, once opened, enters the input mode, which is the editable mode. There are also shortcut keys similar to commands, such as ctrl+c,ctrl+v and so on. In this mode, all commands in the command mode are not valid, guaranteeing that each character typed on your keyboard is the corresponding input, not a command with a special meaning.

(2) Input mode shortcut key:

In input mode, you can also use some of the common shortcuts on Windows, like editing plain text, but you need to add some code to the Gvim startup configuration file. This writing code, this series of blog will be explained in detail later.

Last-line mode (1) What is called the last line mode:

The last line, as the name implies, is the final line. Yes, that's the last line of the pattern, the entire editor's input is positioned to the last line of the editor, not the last line of the document. There is a picture of the truth:

See the last line, there is a colon, followed by the command. So the popular word is the last line of command mode. Many commands can only be executed under the last-line mode, such as exiting, saving God's horse.

(2) The most common command in the last line mode:
: Command Execute function
: Wq |: x Save exit
: Q |: q! do not save Exit | Force Exit
:! Execute shell command
: r!
:%s/good/bad/g
:/good search good
: G Navigate to last line
: 2 Navigate to second row
: 1,10s/^/#/g
: 1,10s/#/^/g One to 10 lines before uncomment
: 1,10>> one to 10 rows right two tab
:1,10<< one to 10 rows left two tab
: 1,10d Delete one to 10 rows

As soon as you get familiar with the three modes of yellowing and some of the commands in the pattern, the speed of writing code or editing text will definitely improve.

PS: The first time to use Markdown to write a blog, immediately like on the, simple and useful, praise a!

Gvim Primer (1)--Three basic modes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.