2018-06-06 03:30:47 +00:00
|
|
|
;;; packages.el --- PDF Layer packages File for Spacemacs
|
2016-02-09 00:00:54 +00:00
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner
|
2020-09-16 21:34:40 +00:00
|
|
|
;; Copyright (c) 2020-2020 Sylvain Benner & Contributors
|
2016-02-09 00:00:54 +00:00
|
|
|
;;
|
|
|
|
;; Author: André Peric Tavares <andre.peric.tavares@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2016-02-09 00:00:54 +00:00
|
|
|
|
2021-02-28 08:00:52 +00:00
|
|
|
(setq pdf-packages '(pdf-tools
|
|
|
|
pdf-view-restore))
|
2016-02-09 00:00:54 +00:00
|
|
|
|
2018-06-06 03:30:47 +00:00
|
|
|
(defun pdf/init-pdf-tools ()
|
2016-02-09 00:00:54 +00:00
|
|
|
(use-package pdf-tools
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-03-14 21:25:19 +00:00
|
|
|
:mode (("\\.pdf\\'" . pdf-view-mode))
|
2020-11-02 15:23:10 +00:00
|
|
|
:init
|
|
|
|
(spacemacs//pdf-tools-setup-transient-state)
|
2016-02-09 00:00:54 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(pdf-tools-install)
|
2016-03-04 05:51:34 +00:00
|
|
|
|
2016-02-09 00:00:54 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'pdf-view-mode "ma" "annotations")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'pdf-view-mode "mf" "fit")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'pdf-view-mode "ms" "slice/search")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'pdf-view-mode
|
|
|
|
;; Slicing image
|
|
|
|
"sm" 'pdf-view-set-slice-using-mouse
|
|
|
|
"sb" 'pdf-view-set-slice-from-bounding-box
|
|
|
|
"sr" 'pdf-view-reset-slice
|
|
|
|
;; Annotations
|
2021-03-13 23:46:14 +00:00
|
|
|
"aD" 'pdf-annot-delete
|
|
|
|
"at" 'pdf-annot-attachment-dired
|
|
|
|
"ah" 'pdf-annot-add-highlight-markup-annotation
|
|
|
|
"al" 'pdf-annot-list-annotations
|
|
|
|
"am" 'pdf-annot-add-markup-annotation
|
|
|
|
"ao" 'pdf-annot-add-strikeout-markup-annotation
|
|
|
|
"as" 'pdf-annot-add-squiggly-markup-annotation
|
|
|
|
"at" 'pdf-annot-add-text-annotation
|
|
|
|
"au" 'pdf-annot-add-underline-markup-annotation
|
2016-02-09 00:00:54 +00:00
|
|
|
;; Fit image to window
|
|
|
|
"fw" 'pdf-view-fit-width-to-window
|
|
|
|
"fh" 'pdf-view-fit-height-to-window
|
|
|
|
"fp" 'pdf-view-fit-page-to-window
|
|
|
|
;; Other
|
|
|
|
"ss" 'pdf-occur
|
|
|
|
"p" 'pdf-misc-print-document
|
|
|
|
"O" 'pdf-outline
|
2016-03-04 05:51:34 +00:00
|
|
|
"n" 'pdf-view-midnight-minor-mode)
|
2016-02-09 00:00:54 +00:00
|
|
|
|
2016-03-04 05:51:34 +00:00
|
|
|
(evil-define-key 'visual pdf-view-mode-map "y" 'pdf-view-kill-ring-save)
|
2016-02-09 00:00:54 +00:00
|
|
|
|
2016-03-04 05:51:34 +00:00
|
|
|
;; TODO: Make `/', `?' and `n' work like in Evil
|
|
|
|
(evilified-state-evilify pdf-view-mode pdf-view-mode-map
|
|
|
|
;; Navigation
|
2016-08-14 19:43:36 +00:00
|
|
|
"0" 'image-bol
|
|
|
|
"$" 'image-eol
|
2016-03-04 05:51:34 +00:00
|
|
|
"j" 'pdf-view-next-line-or-next-page
|
|
|
|
"k" 'pdf-view-previous-line-or-previous-page
|
|
|
|
"l" 'image-forward-hscroll
|
|
|
|
"h" 'image-backward-hscroll
|
|
|
|
"J" 'pdf-view-next-page
|
|
|
|
"K" 'pdf-view-previous-page
|
|
|
|
"gg" 'pdf-view-first-page
|
|
|
|
"G" 'pdf-view-last-page
|
|
|
|
"gt" 'pdf-view-goto-page
|
|
|
|
"gl" 'pdf-view-goto-label
|
|
|
|
"u" 'pdf-view-scroll-down-or-previous-page
|
|
|
|
"d" 'pdf-view-scroll-up-or-next-page
|
|
|
|
(kbd "C-u") 'pdf-view-scroll-down-or-previous-page
|
|
|
|
(kbd "C-d") 'pdf-view-scroll-up-or-next-page
|
|
|
|
(kbd "``") 'pdf-history-backward
|
2020-12-15 14:04:04 +00:00
|
|
|
(kbd "C-o") 'pdf-history-backward
|
|
|
|
(kbd "C-i") 'pdf-history-forward
|
2020-04-12 15:24:37 +00:00
|
|
|
"[" 'pdf-history-backward
|
|
|
|
"]" 'pdf-history-forward
|
2020-02-20 17:11:25 +00:00
|
|
|
"'" 'pdf-view-jump-to-register
|
2016-03-04 05:51:34 +00:00
|
|
|
;; Search
|
|
|
|
"/" 'isearch-forward
|
|
|
|
"?" 'isearch-backward
|
|
|
|
;; Actions
|
|
|
|
"r" 'pdf-view-revert-buffer
|
|
|
|
"o" 'pdf-links-action-perform
|
2016-07-24 19:22:52 +00:00
|
|
|
"O" 'pdf-outline
|
|
|
|
"zr" 'pdf-view-scale-reset)
|
2016-02-09 00:00:54 +00:00
|
|
|
(evilified-state-evilify pdf-outline-buffer-mode pdf-outline-buffer-mode-map
|
|
|
|
"-" 'negative-argument
|
|
|
|
"j" 'next-line
|
|
|
|
"k" 'previous-line
|
|
|
|
"gk" 'outline-backward-same-level
|
|
|
|
"gj" 'outline-forward-same-level
|
2021-08-10 09:16:54 +00:00
|
|
|
(kbd "<backtab>") (if (version< emacs-version "28.0")
|
|
|
|
'outline-show-all
|
|
|
|
'outline-cycle-buffer)
|
2016-02-09 00:00:54 +00:00
|
|
|
"gh" 'pdf-outline-up-heading
|
|
|
|
"gg" 'beginning-of-buffer
|
|
|
|
"G" 'pdf-outline-end-of-buffer
|
|
|
|
"TAB" 'outline-toggle-children
|
|
|
|
"RET" 'pdf-outline-follow-link
|
|
|
|
(kbd "M-RET") 'pdf-outline-follow-link-and-quit
|
|
|
|
"f" 'pdf-outline-display-link
|
|
|
|
[mouse-1] 'pdf-outline-mouse-display-link
|
|
|
|
"o" 'pdf-outline-select-pdf-window
|
|
|
|
"``" 'pdf-outline-move-to-current-page
|
|
|
|
"''" 'pdf-outline-move-to-current-page
|
|
|
|
"Q" 'pdf-outline-quit-and-kill
|
|
|
|
"q" 'quit-window
|
2016-03-04 05:51:34 +00:00
|
|
|
"F" 'pdf-outline-follow-mode)
|
2016-02-09 00:00:54 +00:00
|
|
|
(evilified-state-evilify pdf-annot-list-mode pdf-annot-list-mode-map
|
|
|
|
"f" 'pdf-annot-list-display-annotation-from-id
|
|
|
|
"d" 'tablist-flag-forward
|
|
|
|
"x" 'tablist-do-flagged-delete
|
|
|
|
"u" 'tablist-unmark-forward
|
2016-03-04 05:51:34 +00:00
|
|
|
"q" 'tablist-quit)
|
2016-02-09 00:00:54 +00:00
|
|
|
(evilified-state-evilify pdf-occur-buffer-mode pdf-occur-buffer-mode-map
|
|
|
|
"q" 'tablist-quit
|
|
|
|
"g" 'pdf-occur-revert-buffer-with-args
|
|
|
|
"r" 'pdf-occur-revert-buffer-with-args
|
|
|
|
"*" 'spacemacs/enter-ahs-forward
|
2016-03-04 05:51:34 +00:00
|
|
|
"?" 'evil-search-backward))))
|
2021-02-28 08:00:52 +00:00
|
|
|
|
|
|
|
(defun pdf/init-pdf-view-restore ()
|
|
|
|
(use-package pdf-view-restore
|
|
|
|
:after pdf-tools
|
2021-03-13 23:46:14 +00:00
|
|
|
:defer t
|
2021-02-28 08:00:52 +00:00
|
|
|
:init
|
|
|
|
(add-hook 'pdf-view-mode-hook 'pdf-view-restore-mode)))
|