summaryrefslogtreecommitdiff
path: root/modes/pdf
diff options
context:
space:
mode:
authorPRESFIL <PRESFIL@users.noreply.github.com>2022-08-21 11:43:02 +0000
committerYoumu <condy0919@gmail.com>2022-09-27 01:23:11 +0800
commit6306aa78a94bc517b77bdecde830802c4ac1d9bd (patch)
tree007cfa32f3dfd1a361af96f03276c9b6c67ff2de /modes/pdf
parent76d003c0f0087296fbfe59b13785b6f8db0ce0b0 (diff)
pdf: Add binds for `pdf-history-forward/backward`
... and remove duplicate `(defvars ...)`
Diffstat (limited to 'modes/pdf')
-rw-r--r--modes/pdf/evil-collection-pdf.el30
1 files changed, 26 insertions, 4 deletions
diff --git a/modes/pdf/evil-collection-pdf.el b/modes/pdf/evil-collection-pdf.el
index ee0d78b..3700774 100644
--- a/modes/pdf/evil-collection-pdf.el
+++ b/modes/pdf/evil-collection-pdf.el
@@ -30,8 +30,10 @@
(require 'evil-collection)
(require 'pdf-tools nil t)
(require 'pdf-view nil t)
+(require 'pdf-history nil t)
(defconst evil-collection-pdf-maps '(pdf-view-mode-map
+ pdf-history-minor-mode-map
pdf-outline-buffer-mode-map
pdf-occur-buffer-mode-map))
@@ -40,12 +42,11 @@
(declare-function pdf-view-goto-page "pdf-view")
(declare-function pdf-view-previous-line-or-previous-page "pdf-view")
(declare-function pdf-view-next-line-or-next-page "pdf-view")
+(declare-function pdf-history-forward "pdf-history")
+(declare-function pdf-history-backward "pdf-history")
(defvar pdf-view-mode-map)
-(defvar pdf-outline-buffer-mode-map)
-(defvar pdf-occur-buffer-mode-map)
-
-(defvar pdf-view-mode-map)
+(defvar pdf-history-minor-mode-map)
(defvar pdf-outline-buffer-mode-map)
(defvar pdf-occur-buffer-mode-map)
@@ -95,6 +96,20 @@ Consider COUNT."
(image-bob)
(image-set-window-hscroll hscroll))))
+(defun evil-collection-pdf-jump-forward (&optional count)
+ "Wrap `pdf-history-forward' with `evil'.
+
+Consider COUNT."
+ (interactive "P")
+ (pdf-history-forward (or count 1)))
+
+(defun evil-collection-pdf-jump-backward (&optional count)
+ "Wrap `pdf-history-backward' with `evil'.
+
+Consider COUNT."
+ (interactive "P")
+ (pdf-history-backward (or count 1)))
+
;;;###autoload
(defun evil-collection-pdf-setup ()
"Set up `evil' bindings for `pdf-view'."
@@ -195,6 +210,13 @@ Consider COUNT."
(evil-collection-define-key 'visual 'pdf-view-mode-map
"y" 'pdf-view-kill-ring-save)
+ (evil-collection-inhibit-insert-state 'pdf-history-minor-mode-map)
+ (evil-set-initial-state 'pdf-history-minor-mode 'normal)
+ (evil-collection-define-key 'normal 'pdf-history-minor-mode-map
+ ;; history forward / backward
+ (kbd "C-i") 'evil-collection-pdf-jump-forward
+ (kbd "C-o") 'evil-collection-pdf-jump-backward)
+
(evil-collection-inhibit-insert-state 'pdf-outline-buffer-mode-map)
(evil-set-initial-state 'pdf-outline-buffer-mode 'normal)
(evil-collection-define-key 'normal 'pdf-outline-buffer-mode-map