In Vim, I can combine delete and search:
df[char]
to delete to (and include the char)
dt[char]
to delete to (excluding the char).
In Emacs:
M-z : zap-to-char
is equivalent to df[]
in vim.
Is there a command for deleting to a char?
zap-up-to-char is defined in misc.el (not loaded by default), so you can add this to your .emacs file:
(require 'misc)
(global-set-key (kbd "M-z") 'zap-up-to-char)
Apparently the behavior of M-z was changed from zap-up-to-char to zap-to-char sometime in Emacs 19 (early 90's). Some more discussion: http://www.emacswiki.org/emacs/ZapToCharUsage
misc.el is a small file (200 lines), so shouldn't hinder startup time very much, or you could copy the zap-up-to-char definition to your .emacs - see (find-function 'zap-up-to-char) after requiring misc.
This has been addressed in emacswiki: http://www.emacswiki.org/emacs/ZapUpToChar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With