2018-1-3 4 weeks 2 lessons VIM

Source: Internet
Author: User

5.1 Vim Introduction 5.2 Vim color display and move cursor


Vim is an upgraded version of VI

Vim is a color display.


• Installation package Yum Install-y vim-enhanced

There are three modes of VIM: • General mode, edit mode, command mode


Command mode:/Search

Find replacements

: Wq


The same file, under different directories, may not have a color

/etc/passwd This file is copied to the/tmp directory with no color display

Display color is often based on the specific content of the file, the name of different colors, you can edit the color by/ETC/VIMRC

5.3 Vim General mode move cursor


To move the cursor:

h or left arrow keys The cursor moves one character to the left

L (lowercase l) or right ARROW key or Space The cursor moves one character to the right

K or UP ARROW key move the cursor up one character

J or DOWN ARROW key move the cursor down one character

NH (n is any number) The cursor moves n characters to the left

NL (n is any number) The cursor moves n characters to the right

NK (n is any number) The cursor moves up n characters

NJ (n is any number ) move the cursor down n characters

n spaces (n is any number) move n characters like right


ctrl+f or PageUp The screen moves forward one page

ctrl+b or PageDown The screen moves backward one page

number 0 or shift+6 (^) move to the beginning of the bank

shift+4 ($) move to the end of our line

GG move to First line

G or Shift+g move to Tail line

NG (n is any number) move to Nth row


At the bottom right, you'll be prompted where the cursor is at the first line, the character

game familiar with vim move cursor: https://vim-adventures.com/


5.4 Vim General mode copy, cut and paste

x,x x means to delete/cut one character backwards, x to delete/cut one character forward

NX Delete/cut n characters backwards

DD Delete/cut which line the cursor is in

NDD (n is a number) Delete/cut n rows after the line where the cursor is located

yy                                                                      copy cursor sit in row

p                                                                       from the line where the cursor is located, paste the contents that have been copied or pasted

P from the line where the cursor is located, paste the contents that have been copied or pasted up

Nyy copy n rows down from the line where the cursor is located

u Restore previous action (up to 50 restores)

Ctrl+r when you restore more than once, press the shortcut key to cancel the restore operation .

v Press V to move the cursor will select the specified character, you can copy, paste and other operations



2018-1-3 4 weeks 2 lessons VIM

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.