Last active
March 6, 2023 12:11
-
-
Save ivan-krukov/63a586f2121519ca51b201c634402a84 to your computer and use it in GitHub Desktop.
Personal setup for modal navigation with view mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; add view mode keybindings | |
(use-package view | |
:config (setq view-read-only t) ;; C-x C-q can also toggle view-mode | |
:straight nil | |
:bind (("<f13>" . view-mode) ;; remap R-Shift to F 13 | |
:map view-mode-map | |
("n" . forward-line) | |
("p" . previous-line))) | |
;; make sure the cursor is changed visually | |
(setq-default cursor-type 'bar) | |
(add-hook 'view-mode-hook (defun view-mode-change-cursor-type-hook () | |
(setq cursor-type (if view-mode 'box 'bar)))) | |
;; NB: using a defun in the hook, so debugging is easier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We could map 'n' to next-line, instead of forward-line.
next-line, previous-line obey column width, forward-line snaps to column 0 and proceeds.
Thank you for the gist.
//Abhishek