RyanMarcus icon

Untitled

RyanMarcus | PRO | 05/15/20 10:35:53 PM UTC | 0 ⭐ | 831 👁️ | Never ⏰ | []
text |

560 B

|

None

|

0 👍

/

0 👎

(defun ryanmarcus/backward-kill-word ()
  "Remove all whitespace if the character behind the cursor is whitespace, otherwise remove a word."
  (interactive)
  (if (looking-back "[ \t\n]")
      ;; delete horizontal space before us and then check to see if we
      ;; are looking at a newline
      (progn (delete-horizontal-space 't)
             (while (looking-back "[ \t\n]")
               (backward-delete-char 1)))
    ;; otherwise, just do the normal kill word.
    (backward-kill-word 1)))
 (global-set-key [C-backspace] 'ryanmarcus/backward-kill-word)

Comments