Tab Completion is a great, great feature. It saves me a lot of time and effort, in bash as well as in the Emacs minibuffer.
I don’t know if you are aware of this, but Emacs also comes with a built-in feature called dabbrev-expand (M-/ in the minibuffer). Here is what it does. If you type out the first few letters of your word and hit the key-combo, it auto-completes the word after searching the current buffer and the other open buffers for completion. You can cycle through all possible completions by repeatedly reinvoking the function. This is very, very cool. The only problem is that M-/ is not conducive to speed.
So can we do something super cool like re-bind the function to the TAB key? Without destroying other tab related functions like indentation? Turns out we can!
(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
(if (looking-at “\\_>”)
Add this to your .emacs file, and start using TAB in everything you type. You will find that your typing speed triples!
[hat-tip]THE EMACS WIKI