我最近开始使用“环绕”插件。我意识到我不知道如何包围当前的线路。我的意思是,ysap<p>
围绕一个段落,ysaw<p>
围绕一个单词。显然dw
删除了一个单词,das
删除了一个句子。 dd
会删除一行,但是第二个d
不是我害怕的选择。那么ys??<p>
一行?
答案 0 :(得分:8)
重复s
(yss
),例如cc
,dd
,yy
。
答案 1 :(得分:5)
What you are looking for is the <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<input type="checkbox" id="chk1" value="1" class="chk" />1
<input type="checkbox" id="chk2" value="2" class="chk" />2
<input type="checkbox" id="chk3" value="3" class="chk" />3
<input type="checkbox" id="chk4" value="4" class="chk" />4
<input type="button" id="btn" value="alert" />
</div>
movement.
Ryan's answer is also right,
_
is a easier to tip version of dd
and a lot of commands have this optimization.
As it turns out, d_
has it too (thank you Ryan!) and cheats a bit.
As you can see with surround.vim
it does actually not refer the current line, but the first non-blank character on the :h _
line downwards. This is the behaviour [count] -1
etc. uses. But isn't really what we want in your usecase, dd
will actually give you this:
ys_
Instead of this:
"
line
"
So the "line"
plugin "cheats" a bit, by implementing a surround.vim
command which does not work like yss
, dd
or cc
but works for the usecase it has.
So to answer the question as in the title: yy
is the general solution.
If you are just looking for _
use Ryan's answer