Skip to content

Instantly share code, notes, and snippets.

@coot
Last active February 5, 2020 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coot/aad1f470187e2f9aa078a9d3c4922213 to your computer and use it in GitHub Desktop.
Save coot/aad1f470187e2f9aa078a9d3c4922213 to your computer and use it in GitHub Desktop.
Simple dwm like window managment for vim
" Simple DWM like window managment for vim windows
fun! WinFocus(winnr)
" this assumes that windows have a two column layer: master windows on the
" left, and right column consists of a list of opened windows
if a:winnr == 0
let l:winnr = winnr()
else
let l:winnr = a:winnr
endif
if l:winnr == 1
let l:winnr = 2
endif
set lazyredraw
1wincmd w
wincmd K
exe l:winnr . "wincmd w"
wincmd H
set lazyredraw!
endfun
com -count=0 -addr=windows WinFocus :call WinFocus(<count>)
nm <c-w><c-f> :WinFocus<cr>
nm <C-w>f :WinFocus<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment