- Enable scroll-feature when mouse cursor is on minimap buffer
(leaf minimap :ensure t :require t
:custom
((minimap-window-location . 'right)
(minimap-update-delay . 0.05)
(minimap-minimum-width . 10)
(minimap-width-fraction . 0.01)
(minimap-enlarge-certain-faces . 'always))
:custom-face
(minimap-font-face . '((t (:family "Minimap" :height 10))))
:init
(minimap-mode 1)
(define-advice minimap-new-minimap (:after () hide-truncation-indicators)
"Hide truncation fringe indicators in the minimap buffer."
(with-current-buffer minimap-buffer-name
(fringe-mode '(1 . 1))
(push '(truncation nil nil) fringe-indicator-alist)))
:preface
(defun i-minimap-mouse-scroll ()
(lambda (event) (interactive "e")
(let ((pointed-buffer (buffer-name (window-buffer (posn-window (event-start event)))))
(delta (if (eq (event-basic-type event) 'mouse-4) -1 1)))
(if (string-equal pointed-buffer minimap-buffer-name)
(if (eq delta -1) (scroll-down 20) (scroll-up 20))
(mwheel-scroll event delta)))))
(global-set-key [mouse-4] (i-minimap-mouse-scroll))
(global-set-key [mouse-5] (i-minimap-mouse-scroll))
)