File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ if !exists('g:elevator#highlight')
1212endif
1313
1414var s_state = {
15+ enabled: true,
1516 scrolloff : -1 ,
1617 screenrow : -1 ,
1718 topline: -1 ,
@@ -36,7 +37,23 @@ def S__calculate_scale(winid__a: number): float
3637 return 1.0 * winheight / (line (' $' , winid__a) + winheight )
3738enddef
3839
40+ export def Toggle ()
41+ s_state.enabled = ! s_state.enabled
42+
43+ if ! s_state.enabled
44+ S__close ()
45+ else
46+ Show (win_getid ())
47+ endif
48+
49+ echo ' Elevator ' .. (s_state.enabled ? ' enabled' : ' disabled' )
50+ enddef
51+
3952export def Show (winid__a: number )
53+ if ! s_state.enabled
54+ return
55+ endif
56+
4057 if s_state.dragging
4158 return
4259 endif
Original file line number Diff line number Diff line change @@ -9,10 +9,7 @@ Version: 0.2
99CONTENTS *elevator-contents*
1010
1111 Intro...................................................|elevator-intro|
12- Mappings.............................................|elevator-mappings|
13- Mouse...................................................|elevator-mouse|
1412 Commands.............................................|elevator-commands|
15- Functions...........................................|elevator-functions|
1613 Variables...........................................|elevator-variables|
1714
1815================================================================================
@@ -23,6 +20,11 @@ VIM and GVIM.
2320
2421Elevator works out of the box and does not require any configuration.
2522
23+ ================================================================================
24+ COMMANDS *elevator-commands*
25+
26+ :ElevatorToggle Toggle scrollbar.
27+
2628================================================================================
2729VARIABLES *elevator-variables*
2830
Original file line number Diff line number Diff line change @@ -11,3 +11,5 @@ augroup Elevator
1111 autocmd WinScrolled * elevator#Show (expand (' <amatch>' )- >str2nr ())
1212 autocmd WinEnter ,BufWinEnter * timer_start (0 , (_) = > elevator#Show (win_getid ()))
1313augroup END
14+
15+ command ! -nargs =0 - bar ElevatorToggle elevator#Toggle ()
You can’t perform that action at this time.
0 commit comments