Skip to content

Instantly share code, notes, and snippets.

@uasi
Created April 7, 2010 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save uasi/358813 to your computer and use it in GitHub Desktop.
Save uasi/358813 to your computer and use it in GitHub Desktop.
" A .vimrc snippet that allows you to move around windows beyond tabs
nnoremap <Tab> :call NextWindowOrTab()<CR>:echo<CR>
nnoremap <S-Tab> :call PreviousWindowOrTab()<CR>:echo<CR>
function! NextWindowOrTab()
if winnr() < winnr("$")
execute "normal \<C-W>\<C-W>"
else
tabnext
execute "normal 1\<C-W>\<C-W>"
endif
endfunction
function! PreviousWindowOrTab()
if winnr() > 1
execute "normal \<C-W>\<S-W>"
else
tabprevious
execute "normal " . winnr("$") . "\<C-W>\<C-W>"
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment