Notes on playing vim-(iii)
In the blink of an eye, May will slip away from the fingers, do not give a little time to daydream, I want to hurry to grasp the tail of May, in the blog add a pen. Then let's go to vim for a while. Use Vim to draw a full stop for May.
Basics
I believe that after playing the vim-notes (a) and play vim-notes (ii) of the study, for the cursor movement has been able to do whatever, but if you want to operate more quickly, the following several cursor movement commands are also essential.
Move the cursor over the current line: 0
^
$
f
F
t
T
,
;
-
0
→ to wardrobe
- ^ → to the first non-blank character
-
$
→ to end of line
-
g_
→ to the last position of the bank that is not the blank character.
-
FA
→ to the next character of a, you can also fs to the next character for S.
-
T,
→ to the first character before the comma. Commas can become other characters.
-
3fa
→ Find the third occurrence of a in the current row.
-
F
and T
→ and F
and T
, just in the opposite direction.
-
Regional Selection <action>a<object>
or <action>i<object>
In visual mode, these commands are powerful and their command format is
<action>a<object>
And<action>i<object>
- The action can be any command, such as
d
(delete), ( y
copy), v
(can be selected depending on the mode).
- The object may be:
w
A word, W
a word separated by a space, a word, a s
p
paragraph. It can also be a special character: "、
‘、
)、
}、
]。
Suppose you have a string (map (+) ("foo"))
. The cursor key is in the o
first position.
vi"
→ Will choose foo
.
va"
→ Will choose "foo"
.
vi)
→ Will choose "foo"
.
va)
→ Will choose ("foo")
.
v2i)
→ Will Choosemap (+) ("foo")
v2a)
→ Will Choose(map (+) ("foo"))
block operation: <C-v>
Block operations, typical operations:0 <C-v> <C-d> I-- [ESC]
^
→ to Wardrobe
<C-v>
→ Start block operation
<C-d>
→ Move down (you can also use HJKL to move the cursor, or use%, or something else)
I-- [ESC]
→i is inserted, insert " --
", press ESC to take effect for each line.
Under Windows Vim, you need to use <C-q>
instead <C-v>
of copy the <C-v>
Clipboard.
Automatic hints: <C-n>
and <C-p>
In Insert mode, you can enter the beginning of a word, and then press<C-p>或是<C-n>,自动补齐功能就出现了……
macro recording: qa
sequence q
@a
@@
of Operations ,
Visual selection: v
, V
, <C-v>
Earlier, we saw <C-v>
The example (under Windows should be <C-q>) that we can use v
and V
. Once you've been chosen, you can do the following:
J
→ Connect all rows together (into one line)
<
or >
→ Left and right indent
=
→ Auto Indent
Add something after all the selected lines:
<C-v>
- Select the relevant line (you can use or or ...
j
<C-d>
/pattern
%
)
$
To the end of the line
A
, enter a string, pressESC。
split screen: :split
and vsplit
Here are the main commands you can use to help with Vim :help split
. You can refer to Chenhao previous article vim split screen.
:split
→ Create split screen ( :vsplit
create vertical split screen)
<C-w><dir>
: dir is the direction, can be hjkl
or one of ←↓↑→, it is used to switch split screen.
<C-w>_
(or <C-w>|
): Maximized size (<c-w>| vertical split screen)
<C-w>+
(or <C-w>-
): Increase size
Reference: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
PS: This blog Welcome to forward, but please specify the blog address and author, because I level limited, if there is wrong, welcome point, Thank you ~
Blog Address: http://www.cnblogs.com/voidy/
Blog: http://voidy.net
<. ))) ≦
Notes on playing vim-(iii)