Skip to content

Instantly share code, notes, and snippets.

@tyru
Forked from mmisono/.vimrc
Created July 14, 2010 14:16
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 tyru/475461 to your computer and use it in GitHub Desktop.
Save tyru/475461 to your computer and use it in GitHub Desktop.
submode: changing window size
call submode#enter_with('winsize', 'n', '', 'mws', ':<C-u>call VimrcSubmodeResizeWindow()<CR>')
call submode#leave_with('winsize', 'n', '', '<Esc>')
function! VimrcSubmodeResizeWindow()
let curwin = winnr()
wincmd j | let target1 = winnr() | exe curwin "wincmd w"
wincmd l | let target2 = winnr() | exe curwin "wincmd w"
execute printf("call submode#map ('winsize', 'n', 'r', 'j', '<C-w>%s')", curwin == target1 ? "-" : "+")
execute printf("call submode#map ('winsize', 'n', 'r', 'k', '<C-w>%s')", curwin == target1 ? "+" : "-")
execute printf("call submode#map ('winsize', 'n', 'r', 'h', '<C-w>%s')", curwin == target2 ? ">" : "<")
execute printf("call submode#map ('winsize', 'n', 'r', 'l', '<C-w>%s')", curwin == target2 ? "<" : ">")
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment