VIM: Deleting from current position until a space

ID : 20075

viewed : 3

Tags : vimvim

Top 5 Answer for VIM: Deleting from current position until a space

vote vote

95

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.

vote vote

89

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.

vote vote

72

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.

vote vote

64

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)

vote vote

51

  • delete for the current position to a specific character example "

    dt"
  • delete the word from the position cursor is on till the end of the word

    dw
  • delete the entire word the cursor is on irrespective of the position the cursor is on the word, this also puts you in insert mode to enable you to insert immediately.

    diw

Top 3 video Explaining VIM: Deleting from current position until a space

Related QUESTION?