RyanMarcus

Untitled

May 15th, 2020
827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. (defun ryanmarcus/backward-kill-word ()
  2. "Remove all whitespace if the character behind the cursor is whitespace, otherwise remove a word."
  3. (interactive)
  4. (if (looking-back "[ \t\n]")
  5. ;; delete horizontal space before us and then check to see if we
  6. ;; are looking at a newline
  7. (progn (delete-horizontal-space 't)
  8. (while (looking-back "[ \t\n]")
  9. (backward-delete-char 1)))
  10. ;; otherwise, just do the normal kill word.
  11. (backward-kill-word 1)))
  12.  
  13. (global-set-key [C-backspace] 'ryanmarcus/backward-kill-word)
Advertisement
Add Comment
Please, Sign In to add comment