Update, simplify and add smooth scrolling toggle on SPC t v
This commit is contained in:
parent
b7f4d90ce2
commit
0ca738989e
|
@ -919,6 +919,7 @@ and ~T~):
|
||||||
| ~SPC t l~ | toggle truncate lines |
|
| ~SPC t l~ | toggle truncate lines |
|
||||||
| ~SPC t L~ | toggle visual lines |
|
| ~SPC t L~ | toggle visual lines |
|
||||||
| ~SPC t n~ | toggle line numbers |
|
| ~SPC t n~ | toggle line numbers |
|
||||||
|
| ~SPC t v~ | toggle smooth scrolling |
|
||||||
|
|
||||||
| Key Binding | Description |
|
| Key Binding | Description |
|
||||||
|-------------+--------------------------------------------------------------|
|
|-------------+--------------------------------------------------------------|
|
||||||
|
@ -1405,9 +1406,11 @@ On Windows, you may want to disable it. To disable the smooth scrolling set the
|
||||||
=dotspacemacs-smooth-scrolling= variable in your =~/.spacemacs= to =nil=:
|
=dotspacemacs-smooth-scrolling= variable in your =~/.spacemacs= to =nil=:
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq-default dotspacemacs-smooth-scrolling t)
|
(setq-default dotspacemacs-smooth-scrolling nil)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
You can also toggle smooth scrolling with ~SPC t v~.
|
||||||
|
|
||||||
*** Vim motions with avy
|
*** Vim motions with avy
|
||||||
Spacemacs uses the =evil= integration of [[https://github.com/abo-abo/avy][avy]] which enables the
|
Spacemacs uses the =evil= integration of [[https://github.com/abo-abo/avy][avy]] which enables the
|
||||||
invocation of =avy= during motions.
|
invocation of =avy= during motions.
|
||||||
|
|
|
@ -233,32 +233,33 @@
|
||||||
(spacemacs//neotree-key-bindings)))
|
(spacemacs//neotree-key-bindings)))
|
||||||
|
|
||||||
(defun spacemacs-ui-visual/init-smooth-scrolling ()
|
(defun spacemacs-ui-visual/init-smooth-scrolling ()
|
||||||
(defun spacemacs//unset-scroll-margin ()
|
|
||||||
"Set scroll-margin to zero."
|
|
||||||
(setq-local scroll-margin 0))
|
|
||||||
|
|
||||||
(use-package smooth-scrolling
|
(use-package smooth-scrolling
|
||||||
:if dotspacemacs-smooth-scrolling
|
:init
|
||||||
:init (setq smooth-scroll-margin 5
|
|
||||||
scroll-conservatively 101
|
|
||||||
scroll-preserve-screen-position t
|
|
||||||
auto-window-vscroll nil)
|
|
||||||
:config
|
|
||||||
(progn
|
(progn
|
||||||
(setq scroll-margin 5)
|
(setq smooth-scroll-margin 5)
|
||||||
|
(spacemacs|add-toggle smooth-scrolling
|
||||||
|
:status smooth-scrolling-mode
|
||||||
|
:on (progn
|
||||||
|
(smooth-scrolling-mode)
|
||||||
|
(enable-smooth-scroll-for-function previous-line)
|
||||||
|
(enable-smooth-scroll-for-function next-line)
|
||||||
|
(enable-smooth-scroll-for-function isearch-repeat))
|
||||||
|
:off (progn
|
||||||
|
(smooth-scrolling-mode -1)
|
||||||
|
(disable-smooth-scroll-for-function previous-line)
|
||||||
|
(disable-smooth-scroll-for-function next-line)
|
||||||
|
(disable-smooth-scroll-for-function isearch-repeat))
|
||||||
|
:documentation "Smooth scrolling."
|
||||||
|
:evil-leader "tv")
|
||||||
|
(unless dotspacemacs-smooth-scrolling
|
||||||
|
(spacemacs/toggle-smooth-scrolling-off))
|
||||||
;; add hooks here only for emacs built-in packages that are not owned
|
;; add hooks here only for emacs built-in packages that are not owned
|
||||||
;; by a layer.
|
;; by a layer.
|
||||||
|
(defun spacemacs//unset-scroll-margin ()
|
||||||
|
"Set scroll-margin to zero."
|
||||||
|
(setq-local scroll-margin 0))
|
||||||
(spacemacs/add-to-hooks 'spacemacs//unset-scroll-margin
|
(spacemacs/add-to-hooks 'spacemacs//unset-scroll-margin
|
||||||
'(messages-buffer-mode-hook))))
|
'(messages-buffer-mode-hook)))))
|
||||||
|
|
||||||
(unless dotspacemacs-smooth-scrolling
|
|
||||||
;; deactivate smooth-scrolling advices
|
|
||||||
(ad-disable-advice 'previous-line 'after 'smooth-scroll-down)
|
|
||||||
(ad-activate 'previous-line)
|
|
||||||
(ad-disable-advice 'next-line 'after 'smooth-scroll-up)
|
|
||||||
(ad-activate 'next-line)
|
|
||||||
(ad-disable-advice 'isearch-repeat 'after 'isearch-smooth-scroll)
|
|
||||||
(ad-activate 'isearch-repeat)))
|
|
||||||
|
|
||||||
(defun spacemacs-ui-visual/init-spaceline ()
|
(defun spacemacs-ui-visual/init-spaceline ()
|
||||||
(use-package spaceline-config
|
(use-package spaceline-config
|
||||||
|
|
Loading…
Reference in a new issue