Suppose the following line and cursor position:
foo = some_func(1 +[ ]2)
^^^
cursor position
Using di
+ (
I could easily get rid of everything inside the brackets or delete everything to line start or end using d^
and d$
respectively, but what would I do if I would like to delete everything that comes after =
?
The resulting line should be:
foo =[ ]
^^^
cursor position
dT
+=
deletes everything until (backwards) the character =
, but it still leaves 2)
in the line, ending up in:
foo =[2])
^^^
cursor position
I could, of course, jump to =
first and then use d$
to delete everything until line ending, but I would prefer a simple shortcut based on current cursor position without the need to move the cursor (if such a shortcut exists).
答案 0 :(得分:2)
T = D (跳至=
之后,删除到行尾)是最短的方法
您可以先进行移动,但这要复杂得多::s/=\@<=.*//
CR