(Change to TipImported template + severe manual clean) |
Carpetsmoker (talk | contribs) ({{delete|This tip adds a grand total of one very basic keybind (:tabn and :tabp already mapped by default).}}) |
||
Line 1: | Line 1: | ||
+ | {{delete|This tip adds a grand total of one very basic keybind (:tabn and :tabp already mapped by default).}} |
||
+ | |||
{{review}} |
{{review}} |
||
{{TipImported |
{{TipImported |
Revision as of 04:20, 14 April 2008
created September 29, 2006 · complexity basic · author mchenryk · version 7.0
Add the following lines to your vimrc:
map <C-t> :tabnew<CR> map <C-left> :tabp<CR> map<C-right> :tabn<CR>
Then in gvim you have the following commands:
- Ctrl-t – open a new tab
- Ctrl-left arrow – move one tab to the left
- Ctrl-right arrow – move one tab to the right
Comments
Does not work in [ax]term.
Or you could use gt and gT without having to move your hands across the keyboard.
I use Vim in Windows, so remapping C-Left isn't great for me. These are the mappings I use:
" Tab mappings map <S-Up> :tabclose<CR> map <S-Down> :tabnew<CR> map <S-Left> gT map <S-Right> gt map <S-PageUp> :tabfirst<CR> map <S-PageDown> :tablast<CR>
I used down for a new tab because I'm used to that from Opera's mouse gestures.
I prefer gt and gT. In any case <C-PgUp> and <C-PgDn> are the defaults for the same operations.
Just opening a new tab is kind of useless. I find :tabe <filename> more useful.
Instead of :tabe filename, I like :tabf filename, because it walks the path to find the name, instead of relying on an required explicit path/filename.
If you are working with tags or cscope, <Ctrl-T> is for popping the stack.