Use of the Linux-Vim Editor

Source: Internet
Author: User

I. vim Editor: Text Editor, Word Processor
ASCII
Nano, sed
Vi: Visual Interface
Vim: VI iMproved
Full Screen Editor and model Editor
Ii. vim mode:
1. edit mode (command mode)
2. input mode
3. Last Row Mode
Iii. Mode Conversion:
1. Edit --> input: (edit mode> input mode)
I: Switch to input mode before the character of the current cursor;
A: After the character of the current cursor, convert it to the input mode;
O: at the bottom of the row where the current cursor is located, create a new row and convert it to the input mode;
I: Switch to input mode at the beginning of the row where the current cursor is located
A: At the end of the row where the current cursor is located, convert it to the input mode.
O: Create a new row above the row where the current cursor is located and convert it to the input mode;
2. Input --> EDIT: (input mode> edit mode)
Press ESC
3. Edit --> last line:
Press the ':' key
4. Last line --> EDIT:
Press ESC
4. Open a file
Example: # vim/path/to/somefile
1. vim + #: open the file and locate it in line #
2. vim +: open the file and navigate to the last line.
3. vim +/PATTERN: open the file and locate the first row matched by PATTERN.
4. The editing mode is used by default.

5. Close files
1. exit to the last line to close the file
1). Press q to exit
2). Press wq to save and exit
3). Press q! Do not save and exit
4). save by w
5). Press w! Force save
6). Save and exit by x = wq
2. Exit in edit mode
ZZ: Save and exit
6. move the cursor
1. editing mode
1). move by character:
H: left
L: Right
J: Bottom
K: Upper
# H: move # characters; others are the same
2). Move in words
W: Move to the beginning of the next word
E: jump to the end of the current or next word
B: Jump to the beginning of the current or previous word
# W: Move to the next # The first word of a word. The same applies to other words.
3). In-row jump:
0: Beginning of the absolute line
^: The first non-blank character at the beginning of the line
$: End of the absolute line
4). jump between lines
# G: Jump to line;
G: Last line
2. In the last row Mode
1) directly give the row number and jump directly to the row.
2). '.': indicates the current row.
3). '$': Last line
4). '+ #': Down # Line

7. Screen flip (in editing mode)
Ctrl + f: Flip down the screen
Ctrl + B: Flip the screen up
Ctrl + d: Flip down half screen
Ctrl + u: half screen up
8. delete a single character (in editing mode)
X: delete a single character at the cursor
# X: Delete the cursor at and back # characters in total
9. delete a command (d)
1. editing mode)
1) Use the. d command in combination with the jump command;
# Dw: delete # Words
# De: Delete the cursor # Word
# Db: delete # words before the cursor
Others (point 6)
2). dd: Delete the row where the current cursor is located.
# Dd: Delete the rows that contain the current cursor;

Recommended reading:

Vim Learning Guide

Quick learn Vi Editor

Powerful Vim Editor

Build a Vim Development Environment on CentOS 6.2

Vim 7.4a released, a new and faster Regular Expression Engine

Install the highlighted Vim editing tool in CentOS 5.4

Vim tips: C language settings

Set the Vim row number in Ubuntu

Vim editor basic tutorial

  • 1
  • 2
  • Next Page

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.