emacs: pdf-tools: convenient history bindings, more gentle resizing
[~bandali/configs] / .emacs.d / init.el
index 4002d9a..c723488 100644 (file)
@@ -425,6 +425,7 @@ For disabling the behaviour for certain buffers and/or modes."
  ("C-c a i" . ielm)
 
  ("C-c e b" . eval-buffer)
+ ("C-c e e" . eval-last-sexp)
  ("C-c e r" . eval-region)
 
  ("C-c e i" . emacs-init-time)
@@ -440,6 +441,8 @@ For disabling the behaviour for certain buffers and/or modes."
 
  ("C-x k"   . kill-this-buffer)
  ("C-x K"   . kill-buffer)
+ ("C-x s"   . save-buffer)
+ ("C-x S"   . save-some-buffers)
 
  :map emacs-lisp-mode-map
  ("<C-return>" . b/add-elisp-section))
@@ -559,8 +562,8 @@ For disabling the behaviour for certain buffers and/or modes."
 ;; *the* right way to do git
 (use-package magit
   :defer 0.5
-  :bind (("C-c g g" . magit-status)
-         ("C-c g s" . magit-status)
+  :bind (("C-x g"   . magit-status)
+         ("C-c g g" . magit-status)
          ("C-c g b" . magit-blame-addition)
          ("C-c g l" . magit-log-buffer-file))
   :config
@@ -1181,7 +1184,10 @@ This function is intended for use with `ivy-ignore-buffers'."
   :config
   (cl-delete-if
    (lambda (p) (string-match "^---?" (car p)))
-   tex--prettify-symbols-alist))
+   tex--prettify-symbols-alist)
+  :hook ((tex-mode . auto-fill-mode)
+         (tex-mode . flyspell-mode)
+         (tex-mode . (lambda () (electric-indent-local-mode -1)))))
 
 \f
 ;;; Theme
@@ -1293,8 +1299,7 @@ This function is intended for use with `ivy-ignore-buffers'."
 
 (use-package crux            ; results in Waiting for git... [2 times]
   :defer 0.4
-  :bind (("C-c b k" . crux-kill-other-buffers)
-         ("C-c d"   . crux-duplicate-current-line-or-region)
+  :bind (("C-c d"   . crux-duplicate-current-line-or-region)
          ("C-c D"   . crux-duplicate-and-comment-current-line-or-region)
          ("C-c f c" . crux-copy-file-preserve-attributes)
          ("C-c f d" . crux-delete-file-and-buffer)
@@ -1518,7 +1523,16 @@ This function is intended for use with `ivy-ignore-buffers'."
   (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
   (yas-reload-all)
   (setq yas-verbosity yas-verbosity-cur)
-  (define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand)
+
+  (defun b/yas--maybe-expand-key-filter (cmd)
+    (when (and (yas--maybe-expand-key-filter cmd)
+               (not (bound-and-true-p git-commit-mode)))
+      cmd))
+  (defconst b/yas-maybe-expand
+    '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter))
+  (define-key yas-minor-mode-map
+    (kbd "SPC") b/yas-maybe-expand)
+
   (yas-global-mode))
 
 (use-package debbugs)
@@ -1574,8 +1588,11 @@ This function is intended for use with `ivy-ignore-buffers'."
 (use-package pdf-tools
   :defer 0.5
   :bind (:map pdf-view-mode-map
-              ("M-RET" . image-previous-line))
-  :config (pdf-tools-install nil t))
+              ("<XF86Back>"    . pdf-history-backward)
+              ("<XF86Forward>" . pdf-history-forward)
+              ("M-RET"         . image-previous-line))
+  :config (pdf-tools-install nil t)
+  :custom (pdf-view-resize-factor 1.05))
 
 (use-package biblio)