Skip to content

Instantly share code, notes, and snippets.

@eiiches
Created July 17, 2011 17:12
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 eiiches/1087808 to your computer and use it in GitHub Desktop.
Save eiiches/1087808 to your computer and use it in GitHub Desktop.
Continous window resize in vim.
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