-
-
Save tyru/475461 to your computer and use it in GitHub Desktop.
submode: changing window size
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
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