Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
[Deprecated] Tab/Win Move Commands for vim.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

TWMC - Deprecated

This plugin is deprecated.

It is merged to twcmd.vim plugin (, and not will be updated any more.

TWMC is a set of useful commands for moving a tab, window or a cursor between vim's tabs / windows. It provides additional useful commands such as maxmizing a window.

TWMC is composed of three commands:

  • Winmove : Move the current window between windows.
  • Tabcmd : :wincmd-style tab management command including moving commands for a cursor between tabs.
  • WincmdEx : Extension of the original :wincmd.

Each command has several sub-commands called by :wincmd-style single character arguments.


In vim normal mode, you can just type :Winmove {arg} (similar to :wincmd {arg}).
List of available {arg} is:

{arg} Winmove
h Move current window to left.
l Move current window to right.
j Move current window to down.
k Move current window to up.
p Move current window to location of previously focused window.

and all other arguments used in :wincmd that move a cursor such as w, W, t, b.


In normal mode, just type :Tabcmd {arg}.

{arg} Tabcmd
h Go to the left tab page.
l Go to the right tab page.
W Go to the left tab page. Wraps around from the first to the last one.
w Go to the right tab page. Wraps around from the last to the first one.
t Go to the first tab page.
b Go to the last tab page.
p Go to the previous tab page.
q Close current tab page and move focus to previously focused one.
n Open a new tab page with an empty window, after the current tab page.
o Close all other tab pages.


This command overrides the original :wincmd command.
In normal mode, just type :WincmdEx {arg}.

{arg} WincmdEx
q Quit current window and move cursor to previously focused one.
m Toggle maximizing current window.

and all other arguments used in :wincmd.

Recommended Key Mappings

TWMC does not provide default key mappings to keep your key mappings clean. Instead, I suggest convinient key mappings what I'm using now. You can add them to your .vimrc if you want. Of course, you can modify it as you want.

function! s:nnoreicmap(option, shortcut, command)
    execute 'nnoremap '.a:option.' '.a:shortcut.' '.a:command
    execute 'imap '.a:option.' '.a:shortcut.' <Esc>'.a:shortcut
    execute 'cmap '.a:option.' '.a:shortcut.' <Esc>'.a:shortcut

" move current window between windows
call s:nnoreicmap('','<A-y>',':Winmove h<CR>')
call s:nnoreicmap('','<A-u>',':Winmove j<CR>')
call s:nnoreicmap('','<A-i>',':Winmove k<CR>')
call s:nnoreicmap('','<A-o>',':Winmove l<CR>')
call s:nnoreicmap('','<A-0>',':Winmove p<CR>')

" move cursor between tabs & tab management
call s:nnoreicmap('','<A-H>',':Tabcmd h<CR>')
call s:nnoreicmap('','<A-L>',':Tabcmd l<CR>')
call s:nnoreicmap('','<A-P>',':Tabcmd p<CR>')
call s:nnoreicmap('','<A-Q>',':Tabcmd q<CR>')
call s:nnoreicmap('','<A-N>',':Tabcmd n<CR>')

" move cursor between windows & window management
call s:nnoreicmap('','<A-h>',':WincmdEx h<CR>')
call s:nnoreicmap('','<A-j>',':WincmdEx j<CR>')
call s:nnoreicmap('','<A-k>',':WincmdEx k<CR>')
call s:nnoreicmap('','<A-l>',':WincmdEx l<CR>')
call s:nnoreicmap('','<A-p>',':WincmdEx p<CR>')
call s:nnoreicmap('','<A-q>',':WincmdEx q<CR>')
call s:nnoreicmap('','<A-n>',':WincmdEx n<CR>')
call s:nnoreicmap('','<A-v>',':WincmdEx v<CR>')
call s:nnoreicmap('','<A-s>',':WincmdEx s<CR>')
call s:nnoreicmap('','<A-m>',':WincmdEx m<CR>')

I've define the function s:nnoreicmap() to map for normal, insert and command-line modes simultaneously, and installed vim-fixkey plugin to use alt-key mappings. <A-H> means alt+shift+h.

Something went wrong with that request. Please try again.