Skip to content

Instantly share code, notes, and snippets.

@tizoc
Created August 11, 2011 19:29
Show Gist options
  • Save tizoc/1140530 to your computer and use it in GitHub Desktop.
Save tizoc/1140530 to your computer and use it in GitHub Desktop.
(defun smart-tab ()
"If mark is active, indents region. Else if point is at the end of a symbol,
expands it. Else indents the current line. Acts as normal in minibuffer."
(interactive)
(cond (mark-active (indent-region (region-beginning) (region-end)))
((and (looking-at "\\_>") (not (looking-at "end")))
(hippie-expand nil))
(t (indent-for-tab-command))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment