Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

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 psliwka#19 (comment)
Can be used as-is, or can be implemented using a dedicated command if
required in the future.

Closes psliwka#17
Closes psliwka#19
  • Loading branch information
subnut committed Nov 22, 2020
1 parent 668a4a5 commit e15afd3
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
Expand Up @@ -6,6 +6,12 @@
" invokes motion (except smoothie#forwards, where it must be set to v:true)
let s:ctrl_f_invoked = v:false

if !exists('g:smoothie_enabled')
""
" Set it to 0 to disable vim-smoothie. Useful for very slow connections.
let g:smoothie_enabled = 1
endif

if !exists('g:smoothie_update_interval')
""
" Time (in milliseconds) between subseqent screen/cursor postion updates.
Expand Down Expand Up @@ -221,6 +227,10 @@ endfunction
""
" Smooth equivalent to ^D.
function smoothie#downwards()
if !g:smoothie_enabled
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 @@ -229,6 +239,10 @@ endfunction
""
" Smooth equivalent to ^U.
function smoothie#upwards()
if !g:smoothie_enabled
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 @@ -237,13 +251,21 @@ endfunction
""
" Smooth equivalent to ^F.
function smoothie#forwards()
if !g:smoothie_enabled
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_enabled
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 e15afd3

Please sign in to comment.