rusty1s/dotfiles

View on GitHub
vim/autoload/window.vim

Summary

Maintainability
Test Coverage
function! window#move(key) abort
  let t:curwin = winnr()
  exec 'wincmd ' . a:key
  if (t:curwin == winnr())
    " We haven't moved, so we create a new window.
    if (match(a:key, '[jk]'))
      wincmd v
    else
      wincmd s
    endif
    " Jump to the newly created window.
    exec 'wincmd ' . a:key
  endif
endfunction