Today I Learned Mapping te to tabedit in Vim
June - 2015
Vim's :tabedit
command seems long considering how often it's used. Applying logic from this StackOverflow answer produces this customization:
cnoreabbrev <expr> te getcmdtype() == ":" && getcmdline() == 'te' ? 'tabedit' : 'te'
It defines a :te
shortcut which expands to :tabedit
. Throw it in ~/.vimrc
and save five characters for every tab open.
It's worth pointing out that this accepted StackOverflow answer provides a dangerous alternative. It recommends ca
(aka cabbrev
). For example, ca te tabedit
. The gotcha hidden in this approach is that it expands across the command. Trying to run :!ls /tmp/te/
will be altered to :!ls /tmp/tabedit/
. Not so good.
And, yes, I added an answer to help out there too.