Table of Contents

nav-flash layer

Table of ContentsClose

1. Description

This layer adds nav-flash package which temporarily highlights the line containing the point, which is sometimes useful for orientation after a navigation command.

1.1. Features:

  • Fancy flashing line on navigation.

2. Installation

To use this configuration layer, add nav-flash to the existing dotspacemacs-configuration-layers list in your ~/.spacemacs.

(setq-default dotspacemacs-configuration-layers
              '(nav-flash))

3. Customization

3.1. Custom Trigger of nav-flash

nav-flash layer works around the following functions:

  • nav-flash/blink-cursor-maybe blinks the line containing the point unless current major mode or current command is excluded, or if so-long-minor-mode is on.
  • nav-flash/delayed-blink-cursor-h blinks after a short pause, which is useful to wait for the point moving to the correct window.

They are added to hooks or after advices of various functions. You can trigger nav-flash in more context viaa dotspacemacs/user-config, for example:

;; blink after triggering evil-window-left/right/up/down
(advice-add #'evil-window-left  :after #'nav-flash/blink-cursor-maybe)
(advice-add #'evil-window-right :after #'nav-flash/blink-cursor-maybe)
(advice-add #'evil-window-up    :after #'nav-flash/blink-cursor-maybe)
(advice-add #'evil-window-down  :after #'nav-flash/blink-cursor-maybe)

;; blink after a delay in after projectile-switch-project
(spacemacs/add-to-hooks #'nav-flash/delayed-blink-cursor-h
                        '(projectile-after-switch-project-hook)
                        t)

3.2. Exclusion Rules

nav-flash/blink-cursor-maybe is configured not to flash the line when either the command or the major mode is excluded, which can be customized via variables nav-flash-exclude-commands and nav-flash-exlude-modes in your dotspacemacs/user-config. For example,

;; don't trigger in dired-mode
(add-to-list 'nav-flash-exclude-modes 'dired-mode )
;; don't trigger for spacemacs/alternate-buffer (SPC TAB)
(add-to-list 'nav-flash-exclude-commands 'spacemacs/alternate-buffer)

4. Credit

This layer is ported from Doom Emacs.

Author: root

Created: 2024-04-03 Wed 19:39

Validate