[deft] Added zetteldeft support
This commit is contained in:
parent
c9c5637ac6
commit
3d597d8ccc
|
@ -1623,6 +1623,8 @@ Other:
|
||||||
- ~SPC m o~ deft open file in other window (thanks to Bahtiar Gadimov)
|
- ~SPC m o~ deft open file in other window (thanks to Bahtiar Gadimov)
|
||||||
- ~SPC m q~ for quitting the deft window (thanks to tinysong)
|
- ~SPC m q~ for quitting the deft window (thanks to tinysong)
|
||||||
- ~SPC m r~ rename selected note (thanks to Bahtiar Gadimov)
|
- ~SPC m r~ rename selected note (thanks to Bahtiar Gadimov)
|
||||||
|
- When zetteldeft is enabled, ~SPC a n~ is moved to ~SPC a n n~
|
||||||
|
- Added zetteldeft support
|
||||||
**** Django
|
**** Django
|
||||||
- Key bindings:
|
- Key bindings:
|
||||||
- Added names to django mode prefixes (thanks to Boris Verhovsky)
|
- Added names to django mode prefixes (thanks to Boris Verhovsky)
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
- [[#features][Features:]]
|
- [[#features][Features:]]
|
||||||
- [[#install][Install]]
|
- [[#install][Install]]
|
||||||
- [[#layer][Layer]]
|
- [[#layer][Layer]]
|
||||||
|
- [[#zetteldeft][Zetteldeft]]
|
||||||
- [[#configuration][Configuration]]
|
- [[#configuration][Configuration]]
|
||||||
- [[#key-bindings][Key bindings]]
|
- [[#key-bindings][Key bindings]]
|
||||||
|
- [[#zetteldeft-key-bindings][Zetteldeft key bindings]]
|
||||||
|
- [[#global][Global]]
|
||||||
|
- [[#org-mode][Org-mode]]
|
||||||
|
|
||||||
* Description
|
* Description
|
||||||
This layer adds a search driven note taking system into Spacemacs.
|
This layer adds a search driven note taking system into Spacemacs.
|
||||||
|
@ -17,6 +21,7 @@ This layer adds a search driven note taking system into Spacemacs.
|
||||||
- Browsing and creating notes with a powerful search function via [[http://jblevins.org/projects/deft/][Deft]].
|
- Browsing and creating notes with a powerful search function via [[http://jblevins.org/projects/deft/][Deft]].
|
||||||
- Integration of =org-mode= as note editor.
|
- Integration of =org-mode= as note editor.
|
||||||
- Configurable list of extensions to recognize as notes.
|
- Configurable list of extensions to recognize as notes.
|
||||||
|
- Zettelkasten system with [[https://github.com/EFLS/zetteldeft][zetteldeft]]
|
||||||
|
|
||||||
* Install
|
* Install
|
||||||
** Layer
|
** Layer
|
||||||
|
@ -24,6 +29,13 @@ To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
||||||
add =deft= to the existing =dotspacemacs-configuration-layers= list in this
|
add =deft= to the existing =dotspacemacs-configuration-layers= list in this
|
||||||
file.
|
file.
|
||||||
|
|
||||||
|
** Zetteldeft
|
||||||
|
Zetteldeft support is included with the layer. To enable it, set the layer variable ~deft-zetteldeft~ to ~t~:
|
||||||
|
|
||||||
|
#+BEGIN_SRC elisp
|
||||||
|
(deft :variables deft-zetteldeft t)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
** Configuration
|
** Configuration
|
||||||
By default deft tries to put notes in =~/.deft= but you can change
|
By default deft tries to put notes in =~/.deft= but you can change
|
||||||
this in your =dotspacemacs/user-config= function:
|
this in your =dotspacemacs/user-config= function:
|
||||||
|
@ -48,6 +60,7 @@ Just add or substitute your preferred extension.
|
||||||
| Key binding | Description |
|
| Key binding | Description |
|
||||||
|-------------+----------------------------------|
|
|-------------+----------------------------------|
|
||||||
| ~SPC a n~ | Open Deft (works globally) |
|
| ~SPC a n~ | Open Deft (works globally) |
|
||||||
|
| ~SPC C d~ | Create new file (works globally) |
|
||||||
| ~SPC m c~ | Clear deft filter |
|
| ~SPC m c~ | Clear deft filter |
|
||||||
| ~SPC m d~ | Delete selected note |
|
| ~SPC m d~ | Delete selected note |
|
||||||
| ~SPC m i~ | Toggle to regex search |
|
| ~SPC m i~ | Toggle to regex search |
|
||||||
|
@ -56,3 +69,33 @@ Just add or substitute your preferred extension.
|
||||||
| ~SPC m o~ | Deft open file in other window |
|
| ~SPC m o~ | Deft open file in other window |
|
||||||
| ~SPC m r~ | Rename selected note |
|
| ~SPC m r~ | Rename selected note |
|
||||||
| ~SPC m q~ | quit deft window |
|
| ~SPC m q~ | quit deft window |
|
||||||
|
|
||||||
|
** Zetteldeft key bindings
|
||||||
|
|
||||||
|
Zetteldeft key bindings will appear in a few different places as follows:
|
||||||
|
|
||||||
|
*** Global
|
||||||
|
|
||||||
|
| Key binding | Description |
|
||||||
|
|---------------------------+--------------------------------|
|
||||||
|
| ~SPC C z~ / ~SPC a n z n~ | New zetteldeft file |
|
||||||
|
| ~SPC a n n~ | Open deft (replaces ~SPC a n~) |
|
||||||
|
| ~SPC a n z T~ | Show tag buffer |
|
||||||
|
| ~SPC a n z s~ | Zetteldeft search-at-point |
|
||||||
|
| ~SPC a n z o~ | Zetteldeft find file |
|
||||||
|
|
||||||
|
*** Org-mode
|
||||||
|
|
||||||
|
| Key binding | Description |
|
||||||
|
|-------------+--------------------------------------------|
|
||||||
|
| ~SPC m z c~ | Search for id of current file |
|
||||||
|
| ~SPC m z f~ | Follow link |
|
||||||
|
| ~SPC m z t~ | Tag search with avy |
|
||||||
|
| ~SPC m z N~ | New file and insert link |
|
||||||
|
| ~SPC m z r~ | Rename file |
|
||||||
|
| ~SPC m z i~ | Find a file and insert link |
|
||||||
|
| ~SPC m z I~ | Find a file and insert link with full name |
|
||||||
|
| ~SPC m z s~ | Search at point |
|
||||||
|
| ~SPC m z l~ | Link search with avy |
|
||||||
|
| ~SPC m z F~ | File search with avy on window |
|
||||||
|
| ~SPC m z o~ | Find file |
|
||||||
|
|
15
layers/+readers/deft/config.el
Normal file
15
layers/+readers/deft/config.el
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
;;; config.el --- deft Layer config 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
|
||||||
|
|
||||||
|
|
||||||
|
(defvar deft-zetteldeft nil
|
||||||
|
"Use zetteldeft if non nil")
|
|
@ -3,6 +3,7 @@
|
||||||
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
||||||
;;
|
;;
|
||||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||||
|
;; Bruno Morais <brunosmmm@gmail.com>
|
||||||
;; URL: https://github.com/syl20bnr/spacemacs
|
;; URL: https://github.com/syl20bnr/spacemacs
|
||||||
;;
|
;;
|
||||||
;; This file is not part of GNU Emacs.
|
;; This file is not part of GNU Emacs.
|
||||||
|
@ -10,7 +11,46 @@
|
||||||
;;; License: GPLv3
|
;;; License: GPLv3
|
||||||
|
|
||||||
(setq deft-packages
|
(setq deft-packages
|
||||||
'(deft))
|
'(
|
||||||
|
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 "anz" "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 "anzn" 'zetteldeft-new-file)
|
||||||
|
(spacemacs/set-leader-keys "anzT" 'zetteldeft-tag-buffer)
|
||||||
|
(spacemacs/set-leader-keys "anzs" 'zetteldeft-search-at-point)
|
||||||
|
(spacemacs/set-leader-keys "anzo" 'zetteldeft-find-file)
|
||||||
|
)))
|
||||||
|
|
||||||
(defun deft/init-deft ()
|
(defun deft/init-deft ()
|
||||||
(use-package deft
|
(use-package deft
|
||||||
|
@ -21,7 +61,14 @@
|
||||||
deft-text-mode 'org-mode
|
deft-text-mode 'org-mode
|
||||||
deft-use-filename-as-title t
|
deft-use-filename-as-title t
|
||||||
deft-use-filter-string-for-filename t)
|
deft-use-filter-string-for-filename t)
|
||||||
(spacemacs/set-leader-keys "an" 'spacemacs/deft)
|
;; in applications prefix, NOTE: backward incompatible keybindings
|
||||||
|
(if deft-zetteldeft
|
||||||
|
(progn
|
||||||
|
(spacemacs/declare-prefix "an" "deft")
|
||||||
|
(spacemacs/set-leader-keys "ann" 'spacemacs/deft))
|
||||||
|
(spacemacs/set-leader-keys "an" 'spacemacs/deft))
|
||||||
|
;; put in capture prefix
|
||||||
|
(spacemacs/set-leader-keys "Cd" 'deft-new-file)
|
||||||
|
|
||||||
(defun spacemacs/deft ()
|
(defun spacemacs/deft ()
|
||||||
"Helper to call deft and then fix things so that it is nice and works"
|
"Helper to call deft and then fix things so that it is nice and works"
|
||||||
|
@ -33,11 +80,11 @@
|
||||||
;; When opening it you always want to filter right away
|
;; When opening it you always want to filter right away
|
||||||
(evil-insert-state nil)))
|
(evil-insert-state nil)))
|
||||||
:config (spacemacs/set-leader-keys-for-major-mode 'deft-mode
|
:config (spacemacs/set-leader-keys-for-major-mode 'deft-mode
|
||||||
"c" 'deft-filter-clear
|
"c" 'deft-filter-clear
|
||||||
"d" 'deft-delete-file
|
"d" 'deft-delete-file
|
||||||
"i" 'deft-toggle-incremental-search
|
"i" 'deft-toggle-incremental-search
|
||||||
"n" 'deft-new-file
|
"n" 'deft-new-file
|
||||||
"N" 'deft-new-file-named
|
"N" 'deft-new-file-named
|
||||||
"q" 'quit-window
|
"q" 'quit-window
|
||||||
"o" 'deft-open-file-other-window
|
"o" 'deft-open-file-other-window
|
||||||
"r" 'deft-rename-file)))
|
"r" 'deft-rename-file)))
|
||||||
|
|
Loading…
Reference in a new issue