5.1-5.4 vim shortcut keys

Source: Internet
Author: User

5.1-5.4

Vim and VI are almost the same, the only difference is that when editing a text, using VI will not show the color, and using VIM will show the color.

VIM has three modes: General mode, edit mode, command mode.

When the system is minimized, the VIM command is not installed and you need to install it yourself using Yum:

[email protected] ~]# Yum install-y vim-enhanced

Version view Vim version of the current system

Move the cursor in general mode

Add:

SPACEBAR: Move right one character number ' 0 ' and shift+6: Move the cursor to the beginning of the line

SHIFT+4: Moves the cursor to the end of the line

Cut, copy, paste in normal mode

Enter edit mode

Return general mode "ESC" from edit mode

Command mode

The difference between ": Wq" and ": X"

    • ": Wq" Mandatory write file and exit (save and exit write and quite). Force write even if the file is not modified, and update the file's modification time.

    • ": X" writes the file and exits. Writes only when the file is modified and updates the file modification time, otherwise the file modification time is not updated.

    • Difference:

The two are generally not the same, but in terms of programming, editing the source file can have a significant impact. Because the file is not modified, ": Wq" forces the update of the file's modification time so that make compiles the entire project with the file being modified, and then the recompile link is delivered to the executable file. This can have misleading consequences and, of course, unnecessary system resource costs. But like version control software generally preferred or compare file content, modification time is generally ignored.

Several shortcut keys commonly used in VIM

    • Note All lines: Ctrl + V j/k+ shift +i

    • View cursor the current man manual shift+k

    • d+f+ characters

    • Check area v+t+ characters

    • Remove all characters after the cursor in VIM shift+d

    • Delete the word on the current cursor d+i+w

    • Select the word on the current cursor v+i+w


5.1-5.4 vim shortcut keys

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.