Created
July 17, 2011 17:12
-
-
Save eiiches/1087808 to your computer and use it in GitHub Desktop.
Continous window resize in vim.
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! PrintMode(mode) | |
if &showmode | |
echoh ModeMsg | echo a:mode | echohl None | |
redraw | |
endif | |
endfunction | |
function! ResizeMode() | |
while 1 | |
call PrintMode('-- RESIZE --') | |
try | |
let key = nr2char(getchar()) | |
if index(['>', '<', '+', '-', '=', 'h', 'l', 'j', 'k'], key) < 0 | |
throw '' | |
endif | |
execute "normal! \<C-w>" . key | |
redraw | |
catch | |
break | |
endtry | |
endwhile | |
call PrintMode('') | |
endfunction | |
nnoremap <silent> <C-w>> <C-w>>:call ResizeMode()<CR> | |
nnoremap <silent> <C-w>< <C-w><:call ResizeMode()<CR> | |
nnoremap <silent> <C-w>- <C-w>-:call ResizeMode()<CR> | |
nnoremap <silent> <C-w>+ <C-w>+:call ResizeMode()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment