Skip to content

Instantly share code, notes, and snippets.

@etscrivner
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save etscrivner/0bd46b65003f243c3a65 to your computer and use it in GitHub Desktop.

Select an option

Save etscrivner/0bd46b65003f243c3a65 to your computer and use it in GitHub Desktop.
Emacs snippet to kill a line backwards to the first whitespace character.
(defun kill-back-to-indentation (arg)
"Ignore ARG. Kill lines backwards to the first whitespace character."
(interactive "p")
(let ((start (point)))
(back-to-indentation)
(kill-region start (point))))
(global-set-key (kbd "C-c DEL") 'backward-kill-to-start-of-line)
;;; Example (Python): (The cursor is $)
;;;
;;; class MyClass(object):
;;; def print_info(self):
;;; logger.info$('%r', info)
;;;
;;; Hit C-c DEL
;;;
;;; class MyClass(object):
;;; def print_info(self):
;;; $('%r', info)
;;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment