Created
January 14, 2010 01:11
-
-
Save mwilliams/276754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(global-set-key [(tab)] 'smart-tab) | |
(defun smart-tab () | |
"This smart tab is minibuffer compliant: it acts as usual in | |
the minibuffer. Else, if mark is active, indents region. Else if | |
point is at the end of a symbol, expands it. Else indents the | |
current line." | |
(interactive) | |
(if (minibufferp) | |
(unless (minibuffer-complete) | |
(dabbrev-expand nil)) | |
(if mark-active | |
(indent-region (region-beginning) | |
(region-end)) | |
(if (looking-at "\\_>") | |
(dabbrev-expand nil) | |
(indent-for-tab-command))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment