Emacs delete up to the beginning of next word (like Vim 'dw')? -
Emacs delete up to the beginning of next word (like Vim 'dw')? -
so i'm trying delete whitespace @ origin of line , when press m-d end removing more content need to:
(add-to-list 'load-path "~/path-to-yasnippet") (require 'yasnippet) (yas-global-mode 1)
^ ^ | |__ want delete here | |___ cursor here i've looked several places haven't been able vim's dw command does.
for instance, emacs' commands operating on words don't seem it.
there many different solutions this, here one:
class="lang-lisp prettyprint-override">(defun forward-kill-whitespace-or-word () "if `point' followed whitespace kill that. otherwise phone call `kill-word'" (interactive) (if (looking-at "[ \t\n]") (let ((pos (point))) (re-search-forward "[^ \t\n]" nil t) (backward-char) (kill-region pos (point))) (kill-word 1)))
edit: p should have been pos.
vim emacs
Comments
Post a Comment