sublime 風のスムーススクロール、ミニマップ、集中モード
smooth-scrolling, minimap and distraction-free mode (inspired by the sublime editor)
- obsolete functions are now removed
Require this script and some of “sublimity-scroll”, “sublimity-map” and “sublimity-attractive”
(require 'sublimity) ;; (require 'sublimity-scroll) ;; (require 'sublimity-map) ;; (require 'sublimity-attractive)
then call command “M-x sublimity-mode” (or put the following expression in your init file).
(sublimity-mode 1)
When you turn sublimity-mode
on, “auto-hscroll-mode” is
automatically disabled, and “sublimity-auto-hscroll-mode” will work
instead. Therefore, to disable horizontal scrolling, set
“sublimity-auto-hscroll-mode” but not “auto-hscroll-mode”.
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.
(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.
(sublimity-map-set-delay 5)
With the setting above, minimap is displayed after 5 seconds of idle time. When sublimity-map-set-delay is called with nil, then 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.
(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)