Vim Editor Common commands

Source: Internet
Author: User
Tags uppercase letter

Redis Advanced configuration file, modify line 37

Ps-ef |grep redis|grep-v grep to view the process and filter the currently viewed process

VI and VIM Introduction
Vim is an upgraded version of VI.
A text editor under the Linux system environment.
command to enter VIM
Vim file name
If the file name is present, open it
If the file name does not exist, you will still be able to enter the Vim editor and save the file after exiting to create the noun.
========================
1. Go to the VIM editor
Vim file name
2. Exit
Do not save exit
: Q

Save exit
: Wq

Do not save forced exits
: q!
3. Enter content
Press the I key to enter edit mode
Free input
Press the ESC key to exit edit mode
Input: Wq Write exit
Press the lowercase o key to enter edit mode and start typing on the next line of the current cursor
Press the ESC key to exit edit mode
Input: W just saves without exiting
Press the A key to enter edit mode to enter content at the end of the current line
Press the capital O key to enter edit mode and input on the previous line of the current row
4. Browse the file contents operation
Show line Numbers
: Set Nu

Position the cursor to the last line
Enter the uppercase letter G

Go back to the first line
Input GG

Go to the line with the specified line number
Enter line number G
Example: 5g,8g

Move cursor up or down
Method One: ↑↓←→
Method Two: HJKL
5. Edit the text contents of the operation
Delete Current line: DD
Delete n rows starting from the current line: DND
Undo the action you just made: U
Redo the action you just made: Ctrl+r
Copy Current line: yy
Paste to the next line in the current row: lowercase letter P
Paste to the previous line of the current row: uppercase P
Replace single character: R (does not enter edit mode)

:!li-l Pause the current file input, then press any key to continue
6. Search keywords
/keywords
N: Go to the next
N: Go to Previous
7. Replace keywords
:%s/replaced text/new text/g
8. Block operations
Start ESC-Exit Insert-->ctrl+v--stroke range->shift+i-Input->ESC complete block repeat
Enter block mode
CTRL + V

Define the scope of the operation of the block by pressing the up or down key

Enter input mode
Shift+i

Start typing
Esc

Vim Editor Common commands

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.