tags:

views:

128

answers:

4

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?

+12  A: 

dw

Neall
+2  A: 

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 d0

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. dge would remove all the whitespace characters leading backwards until a non-whitespace, but it also deletes the first non-whitespace character.

Jason Down
Not quite as neat, since you need to know the character you're deleting to, but deleting back to the = could be accomplished with `dT=`. **D** elete backwards-' **T** il **=**
dash-tom-bang
+3  A: 

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

zigdon
+5  A: 
dtB

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

jinfield