Use my version of backward-kill-word
instead. Add it to your .emacs file.
Created
October 23, 2011 07:26
-
-
Save noahlt/1306993 to your computer and use it in GitHub Desktop.
How do I make emacs' backward-kill-word not kill across line breaks?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun noah-backward-kill () | |
"Exactly like backward-kill-word, except doesn't kill across line breaks." | |
(interactive) | |
(let ((init-pos (point)) | |
(line-begin (line-beginning-position)) | |
(word-begin (backward-word-position))) | |
(if (= (point) line-begin) | |
(backward-delete-char 1) | |
(if (< word-begin line-begin) | |
(kill-region line-begin init-pos) | |
(backward-kill-word 1))))) | |
(global-set-key (kbd "C-w") 'noah-backward-kill) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment