Skip to content

Instantly share code, notes, and snippets.

@EgZvor
Created December 9, 2021 14:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EgZvor/531de9b5299a63470602006ac9ca8cff to your computer and use it in GitHub Desktop.
Save EgZvor/531de9b5299a63470602006ac9ca8cff to your computer and use it in GitHub Desktop.
Smooth window splitting animation for Vim
function SmoothSplit(vertical = 0) abort
syntax off
if a:vertical
let new_size = winwidth(0) / 2
vertical 1 split
else
let new_size = winheight(0) / 2
1 split
endif
if a:vertical
" TODO: adjust diff for a number of windows already open
for i in range(new_size)
vertical resize +1
sleep 1m
redraw
endfor
else
for i in range(new_size)
resize +1
sleep 1m
redraw
endfor
endif
syntax enable
endfunction
nnoremap <c-w>s <cmd>call SmoothSplit(0)<cr>
nnoremap <c-w>v <cmd>call SmoothSplit(1)<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment