Skip to content

Instantly share code, notes, and snippets.

@ainame
Created November 3, 2013 16:43
Show Gist options
  • Save ainame/7292154 to your computer and use it in GitHub Desktop.
Save ainame/7292154 to your computer and use it in GitHub Desktop.
(defun newline-or-open-line ()
"newline-or-openline is a new command for merging C-m and C-o"
(interactive)
(cond ((or (eolp)
(not (string-match "[^\\\s\\\n\\\t]" (buffer-substring (point) (point-at-eol)))))
(progn (newline) (indent-according-to-mode)))
(t (progn (open-line 1) (indent-according-to-mode)))))
(define-key global-map (kbd "C-m") 'newline-or-open-line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment