smooth-scrolling, minimap and distraction-free mode (inspired by the sublime editor)
Require this script and some of
(require 'sublimity) ;; (require 'sublimity-scroll) ;; (require 'sublimity-map) ;; experimental ;; (require 'sublimity-attractive)
then call command
M-x sublimity-mode (or put the following
expression in your init file).
When you turn
automatically disabled, and
sublimity-auto-hscroll-mode will work
instead. Thus, to disable horizontal scrolling, set
sublimity-auto-hscroll-mode but not
sublimity-mode is turned on.
sublimity-scroll (smooth scrolling)
You may configure the speed of smooth-scroll by setting two variables.
(setq sublimity-scroll-weight 10 sublimity-scroll-drift-length 5)
Scroll is basically divided into (weight + drift-length) steps. for example, with the configuration above, 100 lines of scrolling is divided into 15 (= 10 + 5) steps
(17 15 14 12 11 8 7 5 4 2 1 1 1 1 1)
and it looks smoother than 1 step scroll. Note that last 5 steps are all 1 line scrolls, because drift-length is set 5. So you may make scroll more smooth by setting drift-length greater. try :
(setq sublimity-scroll-weight 5 sublimity-scroll-drift-length 10)
With the configuration above, scroll is divided into 15 steps again,
(30 24 18 12 6 1 1 1 1 1 1 1 1 1 1)
but the last 10 steps are all 1 line scrolls. this looks smoother but perhaps more annoying for some users.
sublimity-map (minimap, experimental)
sublimity-map-size, fraction, text-scale
(setq sublimity-map-size 20) (setq sublimity-map-fraction 0.3) (setq sublimity-map-text-scale -7)
sublimity-map-fraction defines the maximum fraction of width that
minimap can get.
sublimity-map-text-scale is passed to
text-scale-set on minimap setup.
(add-hook 'sublimity-map-setup-hook (lambda () (setq buffer-face-mode-face '(:family "Monospace")) (buffer-face-mode)))
sublimity-map-setup-hook will run when minimap is created.
With the setting above, minimap is displayed after 5 seconds of idle
sublimity-map-set-delay is called with
minimap is shown with no delay. This defers from setting delay to 0,
especially when used with sublimity-scroll, in the sense that minimap
looks not deleted at all but gets worse performance.
sublimity-attractive (distraction-free mode)
(setq sublimity-attractive-centering-width 110)
When a positive integer is set, buffer width is truncated to this value and drawn centered. To cancel this feature, set this value nil.
Following functions are available to hide some UI parts.
(sublimity-attractive-hide-bars) (sublimity-attractive-hide-vertical-border) (sublimity-attractive-hide-fringes) (sublimity-attractive-hide-modelines)