From 3c1c90f251621dde50de1637a8e78ab8dffb82ef Mon Sep 17 00:00:00 2001 From: WeraPea Date: Thu, 11 Aug 2022 12:29:01 +0200 Subject: [PATCH] Added stop function and use it when user enters Terminal mode --- autoload/comfortable_motion.vim | 4 ++++ plugin/comfortable_motion.vim | 1 + 2 files changed, 5 insertions(+) diff --git a/autoload/comfortable_motion.vim b/autoload/comfortable_motion.vim index 5aa3a23..2d0f159 100644 --- a/autoload/comfortable_motion.vim +++ b/autoload/comfortable_motion.vim @@ -87,5 +87,9 @@ function! comfortable_motion#flick(impulse) let s:comfortable_motion_state.impulse += a:impulse endfunction +function! comfortable_motion#stop() + let s:comfortable_motion_state.velocity = 0.0 +endfunction + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/plugin/comfortable_motion.vim b/plugin/comfortable_motion.vim index 9935f0d..e7ba624 100644 --- a/plugin/comfortable_motion.vim +++ b/plugin/comfortable_motion.vim @@ -24,6 +24,7 @@ if !exists('g:comfortable_motion_no_default_key_mappings') || nnoremap :call comfortable_motion#flick(-200) endif +autocmd TermEnter * call comfortable_motion#stop() let &cpo = s:save_cpo unlet s:save_cpo