Skip to content

Instantly share code, notes, and snippets.

@eagletmt
Forked from uasi/gist:358813
Created April 7, 2010 13:12

Revisions

  1. eagletmt revised this gist Apr 7, 2010. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions gistfile1.vimrc
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,22 @@
    " 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>
    nnoremap <silent> <Tab> :<C-u>call <SID>NextWindowOrTab()<CR>
    nnoremap <silent> <S-Tab> :<C-u>call <SID>PreviousWindowOrTab()<CR>
    function! NextWindowOrTab()
    function! s:NextWindowOrTab()
    if winnr() < winnr("$")
    execute "normal \<C-W>\<C-W>"
    wincmd w
    else
    tabnext
    execute "normal 1\<C-W>\<C-W>"
    1wincmd w
    endif
    endfunction

    function! PreviousWindowOrTab()
    function! s:PreviousWindowOrTab()
    if winnr() > 1
    execute "normal \<C-W>\<S-W>"
    wincmd W
    else
    tabprevious
    execute "normal " . winnr("$") . "\<C-W>\<C-W>"
    execute winnr("$") . "wincmd w"
    endif
    endfunction
  2. @uasi uasi created this gist Apr 7, 2010.
    22 changes: 22 additions & 0 deletions gistfile1.vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    " 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