Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When possible I create 1 or 2 letter abbreviations for aliases and the like, e.g. x for exit or p for pwd at the command line.

When using vim and doing multiple tabs for different files (which I can switch between with gt or gT btw) I can edit an additional file with :tabe filename which also creates a new tab.

Is there any shortcut or is there any way to create one (perhaps using the .vimrc file?) for something like :ta or :tb or :tt or :tz etc.

share|improve this question
    
You can, but I discourage it. To use one of your examples x for exit is rather easy to accidentally type compared to ZZ (which itself was chosen because it is not easy to accidentally type). Also, training your fingers to conform to vim rather than the converse makes things much nicer when you aren't operating in the context of your .vimrc (which often happens more than you'd expect). –  msw Aug 21 '13 at 10:19
    
Good point, though each to their own. I've shared the 'x' option with others and they've adopted it. I've never done it by mistake and if I did I wouldn't be exiting a 'document edit' in progress, just the command line and ctrl-alt-t gives me another with the history right there. –  Michael Durrant Aug 21 '13 at 12:10
add comment

1 Answer

up vote 2 down vote accepted

There is no shorter :t_ command, but you can make your own:

Put the following in your .vimrc file:

:com! -nargs=? T tabedit <args>

Recall that E183: User defined commands must start with an uppercase letter.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.