Skip to content

Commit

Permalink
Add variable to disable vim-smoothie completely
Browse files Browse the repository at this point in the history
Implements the _Minimal Solution_ as discussed in #19 (comment)
Can be used as-is, or can be implemented using a dedicated command if
required in the future.

Closes #19
  • Loading branch information
subnut committed Nov 16, 2020
1 parent 6d3b2fb commit 4ba9665
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions autoload/smoothie.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
let s:ctrl_f_invoked = v:false

if !exists('g:smoothie_disabled')
""
" Disable vim-smoothie. Useful for very slow connections.
let g:smoothie_disabled = 0
endif

if !exists('g:smoothie_update_interval')
""
" Time (in milliseconds) between subseqent screen/cursor postion updates.
Expand Down Expand Up @@ -215,6 +221,10 @@ endfunction
""
" Smooth equivalent to ^D.
function smoothie#downwards()
if g:smoothie_disabled
exe "normal! \<C-d>"
return
endif
let s:ctrl_f_invoked = v:false
call s:count_to_scroll()
call s:update_target(&scroll)
Expand All @@ -223,6 +233,10 @@ endfunction
""
" Smooth equivalent to ^U.
function smoothie#upwards()
if g:smoothie_disabled
exe "normal! \<C-u>"
return
endif
let s:ctrl_f_invoked = v:false
call s:count_to_scroll()
call s:update_target(-&scroll)
Expand All @@ -231,13 +245,21 @@ endfunction
""
" Smooth equivalent to ^F.
function smoothie#forwards()
if g:smoothie_disabled
exe "normal! \<C-f>"
return
endif
let s:ctrl_f_invoked = v:true
call s:update_target(winheight(0) * v:count1)
endfunction

""
" Smooth equivalent to ^B.
function smoothie#backwards()
if g:smoothie_disabled
exe "normal! \<C-b>"
return
endif
let s:ctrl_f_invoked = v:false
call s:update_target(-winheight(0) * v:count1)
endfunction
Expand Down

0 comments on commit 4ba9665

Please sign in to comment.