This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+readers/deft/packages.el
John Practicalli Stevenson 92c010a207 [applications] refactor key bindings to layer categories
refactor key bindings for applications to provide additional room for
applications and use lower case characters.

Move calc-dispatch to `SPC a *`

Relates to #13503
2020-07-02 23:43:19 +02:00

90 lines
3.2 KiB
EmacsLisp

;;; packages.el --- deft Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; Bruno Morais <brunosmmm@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq deft-packages
'(
deft
(zetteldeft :toggle (eq deft-zetteldeft t))
))
(defun deft/init-zetteldeft ()
(use-package zetteldeft
:if (eq deft-zetteldeft t)
:init
(progn
(spacemacs/declare-prefix-for-mode 'deft-mode "mz" "zetteldeft")
(spacemacs/declare-prefix-for-mode 'org-mode "mz" "zetteldeft")
(spacemacs/declare-prefix "ardz" "zetteldeft")
;; zetteldeft actions in deft mode
(spacemacs/set-leader-keys-for-major-mode 'deft-mode
"zT" 'zetteldeft-tag-buffer
"zn" 'zetteldeft-new-file
)
;; zetteldeft actions in org mode
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"zc" 'zetteldeft-search-current-id
"zf" 'zetteldeft-follow-link
"zt" 'zetteldeft-avy-tag-search
"zN" 'zetteldeft-new-file-and-link
"zr" 'zetteldeft-file-rename
"zi" 'zetteldeft-find-file-id-insert
"zI" 'zetteldeft-find-file-full-title-insert
"zs" 'zetteldeft-search-at-point
"zl" 'zetteldeft-avy-link-search
"zF" 'zetteldeft-avy-file-search-ace-window
"zo" 'zetteldeft-find-file
)
;; new zetteldeft file under capture
(spacemacs/set-leader-keys "Cz" 'zetteldeft-new-file)
;; actions under applications/deft/zetteldeft
(spacemacs/set-leader-keys "ardzn" 'zetteldeft-new-file)
(spacemacs/set-leader-keys "ardzT" 'zetteldeft-tag-buffer)
(spacemacs/set-leader-keys "ardzs" 'zetteldeft-search-at-point)
(spacemacs/set-leader-keys "ardzo" 'zetteldeft-find-file)
)))
(defun deft/init-deft ()
(use-package deft
:defer t
:init
(progn
(setq deft-extensions '("org" "md" "txt")
deft-text-mode 'org-mode
deft-use-filename-as-title t
deft-use-filter-string-for-filename t)
;; in applications prefix, NOTE: backward incompatible keybindings
(if deft-zetteldeft
(progn
(spacemacs/declare-prefix "ard" "deft")
(spacemacs/set-leader-keys "ardn" 'spacemacs/deft))
(spacemacs/set-leader-keys "ard" 'spacemacs/deft))
;; put in capture prefix
(spacemacs/set-leader-keys "Cd" 'deft-new-file)
(defun spacemacs/deft ()
"Helper to call deft and then fix things so that it is nice and works"
(interactive)
(deft)
;; Hungry delete wrecks deft's DEL override
(when (fboundp 'hungry-delete-mode)
(hungry-delete-mode -1))
;; When opening it you always want to filter right away
(evil-insert-state nil)))
:config (spacemacs/set-leader-keys-for-major-mode 'deft-mode
"c" 'deft-filter-clear
"d" 'deft-delete-file
"i" 'deft-toggle-incremental-search
"n" 'deft-new-file
"N" 'deft-new-file-named
"q" 'quit-window
"o" 'deft-open-file-other-window
"r" 'deft-rename-file)))