Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete until whitespace in Emacs

Is there an Emacs function to delete (forward or backwards) until the first whitespace? For example, I have the following line, and the cursor is marked by the caret:

someword ?(&)!* morewords
               ^

I want to delete the backwards the sequence of non-alphanumeric characters, but not the word someword. Using backward-delete-word will wipe out the word as well. The same is with the cursor before the weird characters and kill-word.

like image 743
Little Bobby Tables Avatar asked Nov 28 '22 19:11

Little Bobby Tables


1 Answers

emacs has the function zap-to-char which will delete everything up to a specific character. So, this won't work for all whitespace but if your specific problem is everything up to a space you can use this function. Give the function a negative argument to zap backwards.

like image 87
Bryan Oakley Avatar answered Dec 07 '22 00:12

Bryan Oakley