Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: Deleting from current position until a space

Tags:

vim

Try dtspace. In general dtx deletes from current position till just before x. Just tx moves the cursor to just before character x in current line.

To delete up to and including the space, use dfspace.


You can use dW or dE as @glenn suggested if you don't want to delete the space itself.

A WORD (uppercase W) consists of a sequence of non-blank characters, separated with white space.

Give a look to the word motions.


one possible solution is to use the delete with a search.

so type in d/<space> and vim will delete until it hits a space.


If you want to delete from anywhere inside the WORD, and in a single command, just use daW

(you can of course use daw if you want to limit to a word)

I use it quite a lot because it spare a move to the begining of the word (in your case)