Created
June 18, 2010 15:49
-
-
Save mmisono/443813 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:resizeWindow() | |
call submode#enter_with('winsize', 'n', '', 'mws', '<Nop>') | |
call submode#leave_with('winsize', 'n', '', '<Esc>') | |
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 | |
nmap <C-w>r :<C-u>call <SID>resizeWindow()<CR>mws |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment