Skip to content

Commit

Permalink
Cut animation when switching windows and buffers
Browse files Browse the repository at this point in the history
Fixes #41.
  • Loading branch information
psliwka committed May 25, 2022
1 parent 8673a29 commit 5b8a674
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions autoload/smoothie.vim
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ function! s:finish_moving() abort
endif
endfunction

""
" Skip animation and jump to target position immediately if we're moving and
" the user is about to leave the window or switch to a different buffer.
function! s:handle_leave_event() abort
if !empty(s:target_view)
call s:finish_moving()
endif
endfunction

augroup smoothie_leave_handlers
autocmd!
autocmd WinLeave,BufLeave * call s:handle_leave_event()
augroup end

""
" TODO: current algorithm is rather crude, would be good to research better
" alternatives.
Expand Down

0 comments on commit 5b8a674

Please sign in to comment.