Move cursor and copy cut paste in general mode

Source: Internet
Author: User
Tags imap

Tag: DDP size replaces the shortcut blank cursor position with the first character of HTTP

1. Move the cursor

When moving the cursor, it can be operated by the direction keys of the upper and lower directions, but this is a bit slow, indicating some of the more commonly used shortcut keys under VIM,

The SPACEBAR is also a shortcut that moves to the right, and you can control its position by numbers. For example, by pressing the number 5 and then pressing the SPACEBAR, the cursor will move directly to the right by 5 characters. H, J, K, l these shortcut keys also support the use of numbers to control the number of cursor movements.

2, VIM general mode to move the cursor shortcut

Character movement
H,j,k,l Lower left upper right
In-line movement
W forward moves to the first character of an adjacent word
b Reverse moves to the first character of an adjacent word
B forward a word, with a space and tab as a delimiter
E forward moves to the trailing character of an adjacent word
GE reverse moves to trailing characters of adjacent words
0 number 0, move left cursor to the beginning of the bank;
SHIFT + 6, move left cursor to the beginning of the bank;
SHIFT + 4, move the cursor right to the end of the bank;
Move the cursor right to the end of the bank;
^ Move the cursor to the first non-null character of the bank
Page move
H jumps to the first line of the current screen
M jumps to the middle line displayed on this screen
L jump to the last line
2 h means moving the cursor to line 2nd of the screen
3L means move the cursor to the bottom 3rd line of the screen
z + ENTER is the first line of the current line that becomes the screen
z +-is the current line becoming the last row
CTRL + F moves forward one page (or PAGE down) in the file;
CTRL + B moves back one page (or page up) in the file;
CTRL + D scroll down half screen
CTRL + U scroll up half screen
File move
GG jumps to the first line
G is Shift +g, jump to tail line
NG jumps to n rows, n is any number, the lower right corner can also see the position of the cursor, see,

% jumps to the other side bracket
Move with the Find character
FA is moving forward to the first character a
Fa reverse moves to the first character a
Move between non-adjacent words or characters
8w forward moves to the first character of eight words apart
4Fa reverse move to fourth a character
A larger range of mobile
When the cursor rests on a word, the * key searches for the word within the file and jumps to the next place;
"#" When the cursor rests on a word, "#" searches for the word within the file and jumps to the previous one;
(/) Move to the beginning of the front/back sentence;
{/} jumps to the beginning of the current/next paragraph.
G to the last position of the bank that is not a blank character.
FA to the next character at a, you can also fs to the next character for S.
T, the first character before the comma. Commas can become other characters.
3fa finds the third occurrence of a in the current row.
F/t and F and T are just the opposite direction;
GG positions the cursor to the beginning of the first line of the file;
G position the cursor to the beginning of the last line of the file;
ng or NGG positions the cursor to the start of the nth row

3, copy cut paste

Replace and delete
Vim's General Delete command is D, X (the former deletes the row, the latter deletes the character), and the other features of Vim can be used to achieve the basic deletion function. After you position the cursor at a specified position within a file, you can replace the character that the cursor points with by using other characters, or delete one or more characters or a row or rows from the current cursor position
GG DG Delete all content
D0 Delete to the beginning of the line
DL Delete current character, dl=x
DH Deletes a previous character
DD Delete When moving forward
DJ Delete Previous Line
DK Delete Next Line
DW Delete to the beginning of the next word
De Delete to the end of this word
DE Delete to include punctuation at the end of this word
DB Delete to previous word
DB Delete to previous word including punctuation
10d Delete 10 rows from the beginning of the current line
d$ Delete all characters after the current character (bank)
D Delete the current character to the end of the line. d=d$
KD GG Delete all rows before the current row (not including the current row)
JdG Delete all rows after the current row (excluding the current row)
: 1,10d Delete 1-10 rows
: One, $d delete 11 rows and all subsequent rows
: 1, $d delete all rows
J delete a blank line between two rows, actually merging two rows
RC replaces the current character pointed to by the cursor with C;
The NRC replaces the first n characters pointed to by the cursor with C;
5rA replaces the first 5 characters that the cursor points with A;
x Delete the current character pointed to by the cursor;
NX removes the first n characters that the cursor points to;
3x Delete the first 3 characters that the cursor points to;
DW deletes the word to the right of the cursor;
NDW Delete the n characters to the right of the cursor;
3DW Delete the 3 characters to the right of the cursor;
DB deletes the word to the left of the cursor;
NDB Delete the n characters to the left of the cursor;
5DB Delete the 5 characters to the left of the cursor;
DD deletes the line of the cursor and removes the gap; only one row at a time
NDD deletes (cuts) n rows of content and removes voids;
3DD Delete (cut) 3 lines of content and remove voids;
Vim's regular substitution commands have C and S, and the other features of Vim can be used to implement the underlying replacement function, but after the replacement command is executed, it is usually entered into insert mode by the edit mode
s replaces the character pointed to by the cursor with the body of the input;
S Delete the current line and enter edit mode;
NS replaces the n characters to the right of the cursor with the body of the input;
NS deletes the current row of n rows, and enters edit mode;
CW replaces the word to the right of the cursor with the input body;
CW replaces all characters from the cursor to the end of the line with the input body (same as C $);
NCW replaces the n word to the right of the cursor with the input body;
CB replaces the word on the left of the cursor with the body of the input;
NCB replaces the n characters on the left side of the cursor with the input body;
The CD replaces the line of the cursor with the body of the input;
NCD replaces the n line below the cursor with the body of the input;
C $ replaces all characters from the beginning of the cursor to the end of the bank with the body of the input;
C0 replaces all characters from the beginning of the line to the cursor with the body of the input.
Copy and paste
YY copy when moving forward
Nyy copies the current n rows, such as 2yy to copy the current row and its next row
"+y copy 1 rows to the operating system's clipboard
"+nyy copy n rows to the operating system's clipboard
: 1,10 co 20 after inserting 1-10 rows into line 20th
: 1,co copies the entire file and adds it to the tail of the file
In normal mode, press V (verbatim) or V (Progressive) to enter the visual mode, then move with the JKLH command to select some rows or characters, then press Y to copy
DDP swaps the current row and its next row
XP swaps the current character and a subsequent character
In normal mode, press V (verbatim) or V (Progressive) to enter the visual mode, then move with the JKLH command to select some lines or characters, then press D to cut
NDD cuts the n rows after the current line. Use the P command to paste the clipped content
: 1,10d will cut 1-10 rows. Use the P command to paste the clipped content.
: 1, ten M 20 move the 第1-10 line after the 20th line.
X Cut the current character, i.e. delete one character backwards
3x clipping the current cursor starts backwards by three characters,
X cuts the previous character of the current character, which deletes one character forward. X=dh
P (lowercase p) pasted to the next line or to the right, modified and deleted data automatically to the Pasteboard
P (uppercase p) Paste to the previous line or to the left
Irregular cut paste, you can first press V into the Visual mode visual interface, through the left and RIGHT arrow keys to select the word to replace, and then by the lowercase x cut, press lowercase p paste.

YIW (Yank inner word) Use any letter in a word to copy the word
YW only copies the part from the letter to the ending of the cursor.
Undo and Redo
U undo the last modification undo; restore one operation at a time, recovering up to 50 times. After reverting to the most primitive operation, the text "already in the oldest change" appears in the lower left corner.
. Repeat the last command to modify the body
U Undo All modifications
Ctrl + R cancels the last undo redo
Block editing
V to enter visual mode, use standard shortcut keys to move the cursor to select a block of text, and then enter standard editing commands
CTRL + V column editing
End-of-line block ...

Insert mode
Enter
I inserted at the current position
I Insert at the beginning of the current
A is inserted after the current position
A inserts at the end of the current line
o Insert a row after the current line
O insert a row before the current line
s erase the current character and enter it
x Delete the current character and stay in normal mode
Exit
Esc
CTRL + O transient
CTRL + C cancels any of the current actions
CTRL + [official recommended replacement ESC
Move the cursor so as not to move the cursor into insert mode
CTRL + H cursor shifts the current line at the beginning of IMAP
CTRL + J cursor moves next line beginning IMAP
CTRL + K cursor moves above line end IMAP
CTRL + L cursor moves current line end IMAP
ALT + H cursor moves left one grid IMAP
ALT + J cursor moves down one grid of IMAP
ALT + K cursor moves up one grid of IMAP
ALT + L cursor moves right one grid IMAP

Move cursor and copy cut paste in general mode

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.