The VIM editor uses

Source: Internet
Author: User

Vim is the most famous text/code Editor on Linux , and the GVim of the Vi editor of the early years, while the Windows edition of the system is the version. Its biggest feature is the full use of keyboard commands to edit, away from the mouse operation, although making it difficult to get started, but after the introduction of the keyboard flow of a variety of clever combination operation can bring extremely significant efficiency improvement. Now let's summarize the use of vim.


1. Function Description : Enhanced VI editor

2. Syntax format

vim[necessary parameters [selection parameters]


Necessary parameters

-B Binary Mode

-d diff mode (same as "Vimdiff")

-M read-only mode

-R Read-only mode

-S runtime does not display processing information

-V Runtime displays processing information for detailed messages


Select parameters

+ Jump to end of file after startup

+< lines > Starting from the specified number of lines

-X Edit Encrypted file

-c< commands > Set commands after editing is complete

-o< number > Specify the number of simultaneous open files

"Command after entering VI"


ESC: Exit Edit

:: Enter command

Enter: Display mode

ZZ: Save exit


"Display Mode"


Ctrl+d: Half-PAGE Down

Ctrl+u: Half PAGE Up

Ctrl+f: Turn down one page

Ctrl+b: Turn up one page


: Number: Jumps to the specified line

: $: Jump to last line of file

X: Delete Character

X: Delete character

DD: Delete Row

NDD: deleting n rows

YY: Copying rows

Nyy: Delete n rows

P: Sticky


/key: Look for characters after the cursor

? Key: Finding characters before the cursor

A, b s/f/t:a a T string in place of the F string before a row


[quick Move cursor]
In VI, moving the cursor and editing is two things, because of the distinction, so it is very convenient to do the cursor
Bits and edits. So it's useful to move the cursor a bit faster.

W (e) Move the cursor to the next word.
b move the cursor to the previous word.

0 move the cursor to the beginning of the bank.
^ Move the cursor to the character at the beginning of our line.
$ move the cursor to the end of the bank.

H move the cursor to the first line of the screen.
M moves the cursor to the middle line of the screen.
L move the cursor to the tail line of the screen.
GG moves the cursor to the first line of the document.
G move the cursor to the end of the document line.
C-f (that is, the CTRL key and the F key are pressed together) This command is page down.
C-b (that is, the CTRL key and the B key are pressed together, and then the same) This command is page up.

"This command is very useful, it moves the cursor to the previous mark, such as with GD, * and so on
Once a word is found, enter it again to go back to where it was last stopped.

‘. This command is quite good, it moves the cursor to the last modification line.

`. This command is quite powerful, it moves the cursor to the last modification point.


"Enter edit Mode"


A: Insert from behind the cursor

A: From the last insertion of the cursor line

I: inserting from the cursor

I: Inserting from a non-empty character after the cursor

O: New CCB under the cursor

O: New CCB from above the cursor

"Command mode"

: w: Save

: Q: Exit

: x: Save exit

:! : Enforcement

: N: Edit Next file

: F: Show current information

: E File name: Open file

: R file Name: reads a file into the current text

: Tabe: Create a new tab page

: Close: Closes the current tab

: QA: Close all tags exit

: Set Nu: Shows the number of rows

: Set all: Lists all parameter configuration conditions

: Set AI settings Auto indent

Replace
Replacement is the strong point of VI, because a regular expression can be used to match a string. Here are a few examples.

: s/aa/bb/g replace AA with BB in all strings containing AA that appear on the line where the cursor is located
: s/\<aa\>/bb/g replaces all AA occurrences of the cursor with BB, replacing only the word AA.
:%s/aa/bb/g replaces AA in all occurrences of a document with a BB in a string containing AA
: 12,23s/aa/bb/g replaces AA with BB in all strings containing AA from 12 rows to 23 rows
: 12,23s/^/#/will add # characters from Line 12 to line 23
:%s= *$== Remove any extra space at the end of the line
: g/^\s*$/d deletes all empty lines that do not contain characters (spaces are not included).


"Mode Toggle"


1). Insert mode (text edit mode)

Press "i" switch into insert mode "insert mode", press "I" into the insertion mode is the beginning of the cursor from the current position to enter the file;

After pressing "a" into insert mode, the text is entered from the next position at the current cursor position;

When you press "o" to enter insert mode, you insert a new line and enter text from the beginning of the beginning.


2). Switch from insert mode to command line mode

Press the "esc" key.


3). Enter the last line mode from the command line mode

Enter in command mode: (shift+;)


This article from the "Technology life, Simple not simple" blog, please be sure to keep this source http://willis.blog.51cto.com/11907152/1845689

The VIM editor uses

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.