diff --git a/layers/+spacemacs/spacemacs-defaults/funcs.el b/layers/+spacemacs/spacemacs-defaults/funcs.el index f8ea696c4..3d9c7fe0e 100644 --- a/layers/+spacemacs/spacemacs-defaults/funcs.el +++ b/layers/+spacemacs/spacemacs-defaults/funcs.el @@ -1438,6 +1438,23 @@ using a visual block/rectangle selection." (interactive) (spacemacs/sort-lines-by-column -1)) +;; Show scroll bar when using the mouse wheel +(defun spacemacs//scroll-bar-hide () + " Hide the scroll bar." + (scroll-bar-mode -1)) +(defun spacemacs//scroll-bar-show-delayed-hide (&rest _ignore) + "Show the scroll bar for a couple of seconds, before hiding it. + +This can be used to temporarily show the scroll bar when mouse wheel scrolling. +(advice-add 'mwheel-scroll :after #'spacemacs//scroll-bar-show-delayed-hide) + +The advice can be removed with: +(advice-remove 'mwheel-scroll #'spacemacs//scroll-bar-show-delayed-hide)" + (scroll-bar-mode 1) + (run-with-idle-timer 3 nil #'spacemacs//scroll-bar-hide)) +(when (fboundp 'scroll-bar-mode) + (advice-add 'mwheel-scroll :after #'spacemacs//scroll-bar-show-delayed-hide)) + ;; BEGIN linum mouse helpers (defvar spacemacs-linum-mdown-line nil