Common Operations in the Vim editor and operations in the vim Editor

Source: Internet
Author: User

Common Operations in the Vim editor and operations in the vim Editor

Press I to enter the editing mode

Wq! Force save and exit

Q! Do not save, force exit

! Mandatory

 

Direction key bit:

K

H j l

 

Ctrl + f move down one page

Ctrl + B move one page up

 

Starting with a line 0

$ End of a row

 

 

The last line of the G File

The first line of the gg File

 

Dd deletes the row where the cursor is located.

Yy copies the same cursor

P pasted copy content

 

U rollback ctrl + r forward both are a pair of operations

 

. Decimal point ".", repeat an operation

 

[Esc] exit the editing mode, Shift +; enter the command line mode

 

Ctrl + v block selection, the selected area will be reversed

Y: copy the reversed content.

D. Delete the reversed content.

 

Multi-file editing

You can add a file name after sp. If you need to open the file, enter the file name. If you only enter sp, the same file will be in two windows.

Ctrl + w + j/k move between windows

Ctrl + w + q exit the current window

 

The vim setting value is in the/etc/vimrc file, which is not recommended to be modified. Can be modified ~ /. Vimrc (the default does not exist. You can manually create it if necessary)

 

Vim garbled, as long as it is a coding problem

Echo $ LANG view Encoding

LANG = zh_CN.UTF-8 set encoding

Iconv command can be used to convert language codes


 


Common commands of the vim Editor, all?

This is a vim tutorial. You can modify it directly. Due to word limit, send it to an email address.
Vim is a powerful editor with many commands. Limited space, in this tutorial
I will not go into details. The purpose of this tutorial is to describe some necessary basic commands.
Some commands, you can easily use vim as a universal editor.

It takes about 25-30 minutes to complete this tutorial, depending on your training time.

The command operations in each section will change this article. We recommend that you copy a copy of this article and
Training (if you start the tutorial through vimtutor, this article is already a copy ).

Remember: the design concept of this tutorial is learned during use. In other words, you need
Execute commands to learn their correct usage. If you only read and do not operate, you may
These commands will soon be forgotten!

Now, please make sure that your Shift-Lock (case-insensitive key) has not been pressed, and then press the key on the disk
The cursor key j is enough times to move the cursor until the content in section 1 is fully filled with the screen.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lecture 1 Section 1: move the cursor

※To move the cursor, press the h, j, k, and l keys respectively. ※※

^
K indicates that the key of h is on the left, and is moved to the left every time you press it.
H l's key is on the right, and will move to the right each time you press it.
The j key looks like a downward arrow at the tip.
V

1. move the cursor freely on the screen until you feel comfortable.

2. Press the downstream key (j) until the cursor repeats.

--- Now you should have learned how to move to the next lecture.

3. now use the downstream key to move the cursor to lecture 2.

Tip: If you are not sure about the letter you press, Press ESC to return to Normal mode.
Enter the command you want on the keyboard again.

Tip: The cursor key should work properly. However, with the hjkl key, you can quickly
Move the cursor around the screen.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lecture 1 Section 2: VIM entry and exit

!! Note: Please read the entire section before you can execute the commands described below.

1. Press ESC (this is to ensure that you are in normal mode ).

2. Enter q! Enter

--- Exiting the editor in this way will never save the changes you have made since entering the editor.
If you want to save the changes and exit, enter:
Wq press ENTER

3. If you see a command line prompt, enter the command that can bring you back to this tutorial, that is:

Vimtutor press ENTER

In general, you can also use this method:

Vim tutor press ENTER

--- 'Vim 'indicates entering the vim Editor, while 'tutor' indicates the file you want to edit.

4. If you are confident that you have kept these steps in mind, please exit from step 1 to step 3.
Then enter the editor again. Next, move the cursor to section 3 of the first lecture to continue our tutorial.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lecture 1 ...... remaining full text>

What programming languages does the vim editor apply?

Haha...
Personal explanation: VIM is an editing tool and an editor is not a compiler, so it is suitable for any language. I don't want Eclipse and VC to be an integrated development environment, including editors and compilers. They are only suitable for java and C development. Just like Notepad, C and java programs can be written in notepad, it can only be edited but cannot be compiled. I don't know if you understand this. If you have compiled programs in linux, you will know.

Vim is a text editor similar to Vi, but many new features are added on the basis of Vi. Vim is generally regarded as the best one in the class Vi editor, in fact, the real competitor comes from different Emacs variants.

Easy to use !!!!!!

Related Article

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.