calibredb.el
calibredb.el copied to clipboard
Default Bindings clashing with Evil Mode?
I am using the plugin with a DOOM EMACS configuration, when opening in the dash board the default key bindings, for instance, O to open a file doesn't work. I suspect this is because of evil mode bindings and hence I am currently resorting to M-x calibredb-find-file, I was wondering if there is way to configure the plugin such that it uses key bindings that play nice with evil mode?
The package does not have evil keybindings at this moment. May have in the future.
You may bind by yourself. By the way, I am also using doom emacs :)
Here is the config I use every day, for your reference:
(use-package! calibredb
:defer t
:load-path "~/.doom.d/modules/calibredb/"
:init
(autoload 'calibredb "calibredb")
(map! :leader (:desc "calibredb" :n "ac" #'calibredb))
:config
;; (setq sql-sqlite-program "/usr/bin/sqlite3")
(if IS-LINUX
(setq calibredb-root-dir "~/OneDrive/Org/Doc/Calibre")
(setq calibredb-root-dir "~/OneDrive/Org/Doc/Calibre"))
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
;; (setq calibredb-program "/Applications/calibre.app/Contents/MacOS/calibredb")
(setq calibredb-library-alist `((,calibredb-root-dir)
("~/Documents/Books Library")
("~/Documents/LIB1")
("/Volumes/ShareDrive/Documents/Library/")))
(setq calibredb-virtual-library-alist '(("1. work" . "work \\(pdf\\|epub\\)")
("2. Read it later" . "Readit epub")
("3. rust" . "rust")
("4. stm32" . "stm32")))
(setq calibredb-virtual-library-default-name "Knowdelge Base")
(if (display-graphic-p)
(setq calibredb-format-icons-in-terminal t)
(setq calibredb-format-icons-in-terminal nil))
(setq calibredb-format-all-the-icons nil)
(setq calibredb-comment-width 100)
(setq calibredb-title-width 60)
(setq calibredb-id-width 4)
(setq calibredb-size-show t)
(setq calibredb-download-dir "~/Downloads")
(setq calibredb-fetch-metadata-source-list '("Google" "Amazon.com" "Douban Books"))
(when IS-LINUX
(setq calibredb-list-view-image-max-width 600)
(setq calibredb-list-view-image-max-height 600)
(setq calibredb-detail-view-image-max-width 300)
(setq calibredb-detail-view-image-max-height 300))
;; (use-package! org-ref
;; :after-call calibredb
;; :config
;; (setq calibredb-ref-default-bibliography "~/Desktop/catalog.bib")
;; (add-to-list 'org-ref-default-bibliography calibredb-ref-default-bibliography)
;; (setq org-ref-pdf-directory "~/OneDrive/Doc/Calibre/")
;; (setq org-ref-bibliography-notes "~/OneDrive/Org/Writing/references.org")
;; (setq org-ref-get-pdf-filename-function 'org-ref-get-mendeley-filename))
(map! :map calibredb-search-mode-map
:n "q" 'calibredb-search-quit
:n "n" 'calibredb-virtual-library-next
:n "N" 'calibredb-library-next
:n "p" 'calibredb-virtual-library-previous
:n "P" 'calibredb-library-previous
:n "l" 'calibredb-virtual-library-list
:n "o" 'calibredb-find-file
:n "O" 'calibredb-find-file-other-frame
:n "V" 'calibredb-open-file-with-default-tool
:n "v" 'calibredb-view
:n "d" 'calibredb-remove
:n "D" 'calibredb-remove-marked-items
:n "m" 'calibredb-mark-and-forward
:n "s" 'calibredb-set-metadata-dispatch
:n "e" 'calibredb-export-dispatch
;; :n "b" 'calibredb-catalog-bib-dispatch
:n "a" 'calibredb-add
:n "." 'calibredb-open-dired
:n "," 'calibredb-quick-look
:n "y" 'calibredb-yank-dispatch
:n "u" 'calibredb-unmark-and-forward
:n "DEL" 'calibredb-unmark-and-backward
:n "s" 'calibredb-set-metadata-dispatch
:n "?" 'calibredb-dispatch
:n "/" 'calibredb-search-live-filter
:n "j" 'calibredb-next-entry
:n "k" 'calibredb-previous-entry
:n "M-f" 'calibredb-toggle-favorite-at-point
:n "M-x" 'calibredb-toggle-archive-at-point
:n "M-h" 'calibredb-toggle-highlight-at-point
:n "M-n" 'calibredb-show-next-entry
:n "M-p" 'calibredb-show-previous-entry
:n "R" 'calibredb-search-clear-filter
:n "r" 'calibredb-search-refresh-and-clear-filter
:n "<backtab>" 'calibredb-toggle-view
:n "<tab>" 'calibredb-toggle-view-at-point
:n "TAB" 'calibredb-toggle-view-at-point
:n "RET" 'calibredb-find-file)
(map! :map calibredb-show-mode-map
:nie "q" 'calibredb-entry-quit
:nie "?" 'calibredb-entry-dispatch
:nie "RET" 'calibredb-search-ret)
(map! :map nov-mode-map
:after nov
"h" 'evil-backward-char
"j" 'evil-next-line
"k" 'evil-previous-line
"l" 'evil-forward-char
:g "<tab>" 'shrface-outline-cycle
:nie "TAB" 'shrface-outline-cycle
:nie "S-<tab>" 'shrface-outline-cycle-buffer
:g [backtab] 'shrface-outline-cycle-buffer
:nie "C-j" 'shrface-next-headline
:nie "C-k" 'shrface-previous-headline
:nie "C-t" 'shrface-toggle-bullets
:nie "C-n" 'outline-next-heading
:nie "C-p" 'outline-previous-heading
:nie "C-l" 'shrface-links-counsel
:nie "C-h" 'shrface-headline-counsel
:nv "d" 'my-sdcv-search-at-point
:nv "t" 'my-osx-dictionary-search-at-point
:g "SPC" 'nil
;; :nv "q" 'kill-this-buffer
)
(add-hook 'calibredb-search-mode-hook #'doom-mark-buffer-as-real-h)
(add-hook 'calibredb-show-mode-hook #'doom-mark-buffer-as-real-h)
(use-package! nov
:defer t
:config
;; FIXME: errors while opening `nov' files with Unicode characters
(with-no-warnings
(defun my-nov-content-unique-identifier (content)
"Return the the unique identifier for CONTENT."
(when-let* ((name (nov-content-unique-identifier-name content))
(selector (format "package>metadata>identifier[id='%s']"
(regexp-quote name)))
(id (car (esxml-node-children (esxml-query selector content)))))
(intern id)))
(advice-add #'nov-content-unique-identifier :override #'my-nov-content-unique-identifier)))
上面贴出的config好像某个少个地方括号。
另外在我的doom emacs里面这行命令出现报错
(map! :leader (:desc "calibredb" :n "ac" #'calibredb))
Error caused by user's config or system: /home/bruce/.doom.d/config.el, (error Key sequence a c starts with non-prefix key a)
应该怎么设置一下,谢谢!
You can run (general-auto-unbind-keys)
first.