4 Week 2nd Class VIM general mode cursor move, copy, cut

Source: Internet
Author: User

Second Class around (November 7)

5.1 Vim Introduction

VI This command, which is an essential tool in Linux. The early Unix system is the default editor.

What is the difference between VI and VIM?

Vim is an upgraded version of VI. Color and code hints help to improve the efficiency of your users.


Installation: Yum install-y vim-enhanced

Three modes of VIM: general mode, edit mode, command mode


Skills:

!$ represents the last parameter after entering a space

Vim has a very special usage: # vim +n filename

Here n is a number, such as Vim +100 1.txt will be at the time of vim to position the cursor to the 100th line of 1.txt.


5.2 Vim color display and move cursor

Location, file type, filename, display color may be different

[Email protected] ~]# VIM/ETC/VIMRC # #vimrc配置文件

[Email protected] ~]# VIM/ROOT/.VIMRC # #在用户家目录下的. VIMRC can personalize their vim


5.3 Vim General mode move cursor

n+ shortcut Keys (n means any number.) Enter the number first, then press the shortcut key) Most of the shortcut keys fit this combination, try more )

Character class

Keys Role
h or LEFT ARROW key Move one character to the left
J or DOWN ARROW key Move down one character
K or UP ARROW key Move one character up
L or right ARROW key, Space Move one character to the right

line and Screen classes

Ctrl-f or PageDown Flip a screen to the end of a file (turn to the next page)
Ctrl-b or PageUp Turn one screen to the top of the file (turn to previous page)
0 and Shift-6 0 moves the cursor to the beginning of the line, ^ moves to the beginning of the non-empty character
Shift-4 Cursor moves to end of line
Gg Move cursor to First line
G The cursor moves to the tail line, ng means moving to n rows


5.4 Vim General mode copy, cut and paste

n+ shortcut keys   (n represents any number.) Enter a number first, then press the shortcut key) Most of the shortcuts fit this combination, try )

Keys Role
X,x, after the clip character, press p to paste after the current cursor X cut backward by 1 characters, X to delete one character forward
DD, NDD Clipping cursor row, after clipping cursor n rows
Yy,nyy Copy the line of the cursor, copy yy
P,NP to perform n-paste actions Pastes the cut or copied rows above the line where the cursor is located
P Pastes the cut or copied lines below the line where the cursor is located
U, ctrl-r U back once, ctrl-r forward once, up to 50 times;
V, ctrl-v V visible, highlighted character; ctrl-v visible block, highlighted rectangle block)



4 Week 2nd Class VIM general mode cursor move, copy, cut

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.