0

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.

2
  • 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, 2013 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. Aug 21, 2013 at 12:10

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .