I'm "new" with Emacs. I'm making my own set up but I can't do one thing with killing words. You know what M-DEL
does by default, but I want to make like Sublime Text or VIM. I'll do an example (this is the original text):
Hi, I'm captainepoch
< first post here!
And this is how I do on vim
or Sublime Text
:
Hi, I'm captainepoch
< first post here▮
Do M-DEL
Hi, I'm captainepoch
< first post▮
Do M-DEL
Hi, I'm captainepoch
< first▮
Do M-DEL
Hi, I'm captainepoch
<▮
Do M-DEL
Hi, I'm captainepoch
▮
Here, there's nothing at the beginning of the line and doing M-DEL
in vim makes the cursor go to the end of the previous line.
Hi, I'm captainepoch▮
Do M-DEL
Hi, I'm▮
Do M-DEL
Hi, I'▮
Do M-DEL
Hi, I▮
Do M-DEL
Hi,▮
Do M-DEL
Hi▮
This final M-DEL
will end up deleting the whole text.
▮
A friend of mine did this function:
(defun backward-kill-word (arg)
(interactive "p")
(let ((init-pos (point))
(line-begin (line-beginning-position)))
(if (/= (point) line-begin)
(kill-word (- arg)))))
And it does the job until it got the <
, which does this:
Hi, I'm captainepoch
<▮
Do M-DEL
Hi, I'm▮
<
(< and a space), it deletes that two and the previous word on the previous line. I'd like to delete text as Sublime does.syntax-subword
package might get you close to what you want; I have not used it.