Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't want to always type the word. it's annoying.

share|improve this question
1  
+1 for the wording and laziness that inspired so so many of my personal vim shortcuts – EricR Feb 22 '12 at 2:49
up vote 2 down vote accepted

One approach is a user-defined command. Unfortunately, those can't begin with a lower-case letter, so your next best option is :T:

:commmand -nargs=* T tabnew <args>
share|improve this answer

If you don't like the existing shortcuts for the tab commands, you can add your own. For instance, if you want to make it easy to open a new tab, you might insert this into your .vimrc:

imap ,t <Esc>:tabnew<CR>

This tells Vim to set up a keymap for ,t in insert mode, to run Esc to put Vim into normal mode, then :tabnew and a carriage return to run the command.

From https://www.linux.com/learn/tutorials/442422-vim-tips-using-tabs
See also http://dissociatedpress.net/vim-resources/vim-tips-using-vim-mappings-and-abbreviations/

Use cmap for command-mode mappings.

share|improve this answer
1  
Doing ":cmap t tabnew<CR>" is going to have fairly serious unintended consequences--it will trigger every time you try to type a "t" in the :-command line. – Heptite Jan 8 '12 at 23:55
    
@Heptite: Yes that wouldn't be good. I'll edit the answer to remove that example. – RedGrittyBrick Jan 9 '12 at 0:00

Notwithstanding the other suggestions, here is a more exact answer to your question: I don't think it's possible completely equivalently, but this set of mappings would get you pretty close:

:nnoremap :t<CR>    :tabnew<CR>
:xnoremap :t<CR>    :tabnew<CR>

:nnoremap :t<Space> :tabnew<Space>
:xnoremap :t<Space> :tabnew<Space>

or equivalently, but better:

" :map in Normal and Visual modes, but not Select mode (see :help mapmode-x
:command -nargs=*  Nxmap      nmap     <args>| xmap     <args>
     com -nargs=*  Nxnoremap  nnoremap <args>| xnoremap <args>
     com -nargs=*  Nxunmap    nunmap   <args>| xunmap   <args>

:Nxnoremap :t<CR>    :tabnew<CR>
:Nxnoremap :t<Space> :tabnew<Space>
share|improve this answer

Pick a key you do not use under vim, like say ), and and remap that key to the tabnew command:

:map ) :tabnew^M

To enter the last CR (^M), type ControlV then Enter

share|improve this answer
    
or the IMHO more readable <CR> instead of the ^M – accolade Jan 16 '12 at 6:39
    
@accolade: I prefer ^V^M as it is more portable but in that specific case which is about a vim feature, <CR> would be indeed simpler. – jlliagre Jan 16 '12 at 14:53
    
@jiliagre: interesting, could you elaborate on that portability? – accolade Jan 16 '12 at 23:38
    
@accolade: <CR> is vim specific so is not supported in the original vi command nor in other clones like elvis. ^V^M works with all of them. – jlliagre Jan 17 '12 at 2:24
    
@jiliagre: Oh, I see, thanks! – accolade Jan 17 '12 at 6:31

A builtin shorter alias for :tabnew is :tabe, which is short for :tabedit, which is just synonymous to :tabnew.

share|improve this answer

You must log in to answer this question.

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