[bibtex] cleanup layer, bind helm-bibtex and add ivy support

biblio-/core is pulled in by multiple packages in this
layer already and their package declarations was empty.
Users can access the functionality biblio offers
from helm-bibtex.
This commit is contained in:
Kalle Lindqvist 2018-09-15 23:36:37 +02:00 committed by Maximilian Wolff
parent ba982822c6
commit 63a42d7600
No known key found for this signature in database
GPG key ID: 2DD07025BFDBD89A
2 changed files with 49 additions and 25 deletions

View file

@ -53,8 +53,8 @@ to use Zathura:
(start-process "zathura" "*helm-bibtex-zathura*" "/usr/bin/zathura" fpath)))
#+END_SRC
More configuration options are available and are detailed in the =org-ref= and
=helm-bibtex= package documentations.
More configuration options are available and are detailed in the =org-ref=,
=helm-bibtex= and =ivy-bibtex= package documentations.
* Key bindings
In a Bib(La)TeX file, the following key bindings are added:
@ -69,6 +69,7 @@ In a Bib(La)TeX file, the following key bindings are added:
| ~SPC m i~ | Insert new entry |
| ~SPC m s~ | Sort entry |
| ~SPC m h~ | Various actions on entry |
| ~SPC m m~ | Manage bibtex library |
| ~SPC m l a~ | Lookup and add arXiv paper (don't get PDF) |
| ~SPC m l A~ | Lookup and add arXiv paper (download PDF) |
| ~SPC m l d~ | Lookup and add paper by DOI |

View file

@ -12,27 +12,56 @@
(setq bibtex-packages
'(
auctex
org
org-ref
markdown-mode
(helm-bibtex :requires helm)
biblio
biblio-core
))
(ivy-bibtex :requires ivy)
markdown-mode
org
org-ref))
(defun bibtex/post-init-auctex ()
(spacemacs/set-leader-keys-for-major-mode 'latex-mode
"ic" 'org-ref-insert-link))
(cond ((configuration-layer/layer-used-p 'helm)
(spacemacs/set-leader-keys-for-major-mode 'latex-mode
"ic" 'org-ref-helm-insert-cite-link))
((configuration-layer/layer-used-p 'ivy)
(spacemacs/set-leader-keys-for-major-mode 'latex-mode
"ic" 'org-ref-ivy-insert-cite-link))))
(defun bibtex/init-helm-bibtex ()
(use-package helm-bibtex
:defer t
:init
(spacemacs/set-leader-keys-for-major-mode 'bibtex-mode
"m" 'helm-bibtex)))
(defun bibtex/init-ivy-bibtex ()
(use-package ivy-bibtex
:defer t
:init
(spacemacs/set-leader-keys-for-major-mode 'bibtex-mode
"m" 'ivy-bibtex)))
(defun bibtex/post-init-markdown-mode ()
(cond ((configuration-layer/layer-used-p 'helm)
(spacemacs/set-leader-keys-for-major-mode 'markdown-mode
"ic" 'org-ref-helm-insert-cite-link))
((configuration-layer/layer-used-p 'ivy)
(spacemacs/set-leader-keys-for-major-mode 'markdown-mode
"ic" 'org-ref-ivy-insert-cite-link))))
(defun bibtex/post-init-org ()
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"ic" 'org-ref-insert-link))
(cond ((configuration-layer/layer-used-p 'helm)
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"ic" 'org-ref-helm-insert-cite-link))
((configuration-layer/layer-used-p 'ivy)
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"ic" 'org-ref-ivy-insert-cite-link))))
(defun bibtex/init-org-ref ()
(use-package org-ref
:defer t
:commands (org-ref-bibtex-next-entry
org-ref-bibtex-previous-entry
org-ref-ivy-insert-cite-link
org-ref-open-in-browser
org-ref-open-bibtex-notes
org-ref-open-bibtex-pdf
@ -46,6 +75,8 @@
pubmed-insert-bibtex-from-pmid)
:init
(progn
(add-hook 'org-mode-hook (lambda () (require 'org-ref)))
(evil-define-key 'normal bibtex-mode-map
(kbd "C-j") 'org-ref-bibtex-next-entry
(kbd "C-k") 'org-ref-bibtex-previous-entry
@ -72,16 +103,8 @@
"lA" 'arxiv-get-pdf-add-bibtex-entry
"ld" 'doi-utils-add-bibtex-entry-from-doi
"li" 'isbn-to-bibtex
"lp" 'pubmed-insert-bibtex-from-pmid))))
(defun bibtex/pre-init-org-ref ()
(add-hook 'org-mode-hook (lambda () (require 'org-ref))))
(defun bibtex/post-init-markdown-mode ()
(spacemacs/set-leader-keys-for-major-mode 'markdown-mode
"ic" 'org-ref-insert-link))
(defun bibtex/init-helm-bibtex ())
(defun bibtex/init-biblio ())
(defun bibtex/init-biblio-core ())
"lp" 'pubmed-insert-bibtex-from-pmid))
:config
;; override org-ref's default helm completion with ivy
(when (configuration-layer/layer-used-p 'ivy)
(require 'org-ref-ivy))))