开发者

vim: delete all whitespace characters up to my cursor

is there anyway to delete every character on the same line as a cursor, all the开发者_开发知识库 way up to the cursor? for instance, I might have a line of code that looks like the following:

foo = [cursor]             Bar.new

If my cursor is at the place holder above, is it possible to delete every whitespace character (without using regex?) so that Bar.new is placed at the cursor?


d w


Based on your example, Neall's answer is correct. However, based on your initial question,

is there anyway to delete every character on the same line as a cursor, all the way up to the cursor?

you would type d 0

Actually, you're asking a third question in your title... delete all whitespace characters up to the cursor. That one I'm not sure how to do without regex. d g e would remove all the whitespace characters leading backwards until a non-whitespace, but it also deletes the first non-whitespace character.


Not quite what you want, but perhaps d i w would help - in the example above, it would delete all the whitespace between the = and the Bar. Perhaps c i w space would give you the result you are looking for?


d t B

Will delete any character up to, but not including the 'B'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜