mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
Moving to Doom Emacs!
This commit is contained in:
37
.emacs.d/modules/ui/nav-flash/README.org
Normal file
37
.emacs.d/modules/ui/nav-flash/README.org
Normal file
@@ -0,0 +1,37 @@
|
||||
#+TITLE: ui/nav-flash
|
||||
#+DATE: June 4, 2017
|
||||
#+SINCE: v2.0
|
||||
#+STARTUP: inlineimages
|
||||
|
||||
* Table of Contents :TOC:
|
||||
- [[#description][Description]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#configuration][Configuration]]
|
||||
|
||||
* Description
|
||||
This module flashes the line around the cursor after any significant motion, to
|
||||
make it easy to follow after big operations.
|
||||
|
||||
#+begin_quote
|
||||
Tremendously helpful on large, 1600p+ or 4K displays.
|
||||
#+end_quote
|
||||
|
||||
** Plugins
|
||||
+ [[https://github.com/rolandwalker/nav-flash][nav-flash]]
|
||||
|
||||
* Prerequisites
|
||||
This module has no dependencies.
|
||||
|
||||
* Configuration
|
||||
By default, ~nav-flash~ will be triggered whenever ~recenter~ is called or an
|
||||
entry is added to the jump-list (maanaged by better-jumper).
|
||||
|
||||
~recenter~ is called after many hooks and commands, such as:
|
||||
|
||||
+ better-jumper-post-jump-hook
|
||||
+ rtags-after-find-file-hook
|
||||
+ org-follow-link-hook
|
||||
+ imenu-after-jump-hook
|
||||
+ counsel-grep-post-action-hook
|
||||
+ dumb-jump-after-jump-hook
|
||||
45
.emacs.d/modules/ui/nav-flash/autoload.el
Normal file
45
.emacs.d/modules/ui/nav-flash/autoload.el
Normal file
@@ -0,0 +1,45 @@
|
||||
;;; ui/nav-flash/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +nav-flash--last-point nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun +nav-flash-blink-cursor (&rest _)
|
||||
"Blinks the current line in the current window, to make it clear where the
|
||||
cursor has landed (typically after a large motion, like switching windows or
|
||||
jumping to another part of the file)."
|
||||
(unless (minibufferp)
|
||||
(nav-flash-show)
|
||||
;; only show in the current window
|
||||
(overlay-put compilation-highlight-overlay 'window (selected-window))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +nav-flash-blink-cursor-maybe (&rest _)
|
||||
"Like `+nav-flash-blink-cursor', but no-ops if in special-mode or term-mode,
|
||||
or triggered from one of `+nav-flash-exclude-commands'."
|
||||
(unless (or (memq this-command +nav-flash-exclude-commands)
|
||||
(bound-and-true-p so-long-minor-mode)
|
||||
(derived-mode-p 'so-long-mode 'special-mode 'term-mode)
|
||||
(and (equal (point-marker) (car +nav-flash--last-point))
|
||||
(equal (selected-window) (cdr +nav-flash--last-point))))
|
||||
(+nav-flash-blink-cursor)
|
||||
(setq +nav-flash--last-point (cons (point-marker) (selected-window)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +nav-flash-delayed-blink-cursor-h (&rest _)
|
||||
"Like `+nav-flash-blink-cursor', but links after a tiny pause, in case it
|
||||
isn't clear at run-time if the point will be in the correct window/buffer (like
|
||||
for `org-follow-link-hook')."
|
||||
(run-at-time 0.1 nil #'+nav-flash-blink-cursor-h))
|
||||
|
||||
;;;###autoload
|
||||
(defalias '+nav-flash-blink-cursor-h #'+nav-flash-blink-cursor)
|
||||
;;;###autoload
|
||||
(defalias '+nav-flash-blink-cursor-maybe-h #'+nav-flash-blink-cursor-maybe)
|
||||
;;;###autoload
|
||||
(defalias '+nav-flash-blink-cursor-a #'+nav-flash-blink-cursor-maybe)
|
||||
|
||||
;;;###autoload
|
||||
(defun +nav-flash/blink-cursor (&rest _)
|
||||
"Blink current line using `nav-flash'."
|
||||
(interactive)
|
||||
(+nav-flash-blink-cursor))
|
||||
33
.emacs.d/modules/ui/nav-flash/config.el
Normal file
33
.emacs.d/modules/ui/nav-flash/config.el
Normal file
@@ -0,0 +1,33 @@
|
||||
;;; ui/nav-flash/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +nav-flash-exclude-commands
|
||||
'(mouse-set-point mouse-drag-region evil-mouse-drag-region +org/dwim-at-point
|
||||
org-find-file org-find-file-at-mouse)
|
||||
"A list of commands that should not trigger nav-flash.")
|
||||
|
||||
(use-package! nav-flash
|
||||
:defer t
|
||||
:init
|
||||
;; NOTE In :tools lookup `recenter' is hooked to a bunch of jumping
|
||||
;; commands, which will trigger nav-flash.
|
||||
(add-hook! '(imenu-after-jump-hook
|
||||
better-jumper-post-jump-hook
|
||||
counsel-grep-post-action-hook
|
||||
dumb-jump-after-jump-hook)
|
||||
#'+nav-flash-blink-cursor-maybe-h)
|
||||
|
||||
(add-hook 'doom-switch-window-hook #'+nav-flash-blink-cursor-maybe-h)
|
||||
|
||||
;; `org'
|
||||
(add-hook 'org-follow-link-hook #'+nav-flash-delayed-blink-cursor-h)
|
||||
|
||||
;; `saveplace'
|
||||
(advice-add #'save-place-find-file-hook :after #'+nav-flash-blink-cursor-a)
|
||||
|
||||
;; `evil'
|
||||
(advice-add #'evil-window-top :after #'+nav-flash-blink-cursor-a)
|
||||
(advice-add #'evil-window-middle :after #'+nav-flash-blink-cursor-a)
|
||||
(advice-add #'evil-window-bottom :after #'+nav-flash-blink-cursor-a)
|
||||
|
||||
;; Bound to `ga' for evil users
|
||||
(advice-add #'what-cursor-position :after #'+nav-flash-blink-cursor-a))
|
||||
4
.emacs.d/modules/ui/nav-flash/packages.el
Normal file
4
.emacs.d/modules/ui/nav-flash/packages.el
Normal file
@@ -0,0 +1,4 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; ui/nav-flash/packages.el
|
||||
|
||||
(package! nav-flash)
|
||||
Reference in New Issue
Block a user