defat layer: edit README and refactor init-deft a bit

This commit is contained in:
syl20bnr 2015-04-17 23:33:26 -04:00
parent 0db03300ac
commit 642b044ab9
2 changed files with 47 additions and 19 deletions

View file

@ -1,22 +1,48 @@
# Deft
# Deft configuration layer for Spacemacs
[Deft](http://jblevins.org/projects/deft/) is an Emacs mode inspired by Notational Velocity for quickly browsing and creating notes.
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc/generate-toc again -->
**Table of Contents**
**Note:** You may have to update the `evil-escape` package for deft to work, otherwise filtering will ignore your escape character.
- [Deft configuration layer for Spacemacs](#deft-configuration-layer-for-spacemacs)
- [Description](#description)
- [Differences from default](#differences-from-default)
- [Install](#install)
- [Layer](#layer)
- [Configuration](#configuration)
- [Key Bindings](#key-bindings)
## Differences from default
<!-- markdown-toc end -->
This layer sets the default to use filenames for note titles as well as org-mode for editing.
The default extension is still `txt`.
## Description
## Configuration
[Deft][] is an Emacs mode inspired by `Notational Velocity` for quickly
browsing and creating notes.
### Differences from default
This layer sets the default to use filenames for note titles as well as
`org-mode` for editing. The default extension is still `.txt` though.
## Install
### Layer
To use this contribution add it to your `~/.spacemacs`
```elisp
(setq-default dotspacemacs-configuration-layers '(deft))
```
### Configuration
By default deft tries to put notes in `~/.deft` but you can change
this like so in your `dotspacemacs/config` function:
By default deft tries to put notes in `~/.deft` but you can change this like so:
```
(setq deft-directory "~/Dropbox/notes")
```
## Keybindings
## Key Bindings
Key Binding | Description
--------------------|------------------------------------------------------------------
@ -25,3 +51,5 @@ Key Binding | Description
<kbd>SPC m r </kbd>| Rename selected note
<kbd>SPC m i </kbd>| Toggle to regex search
<kbd>SPC m n </kbd>| Create new file with filter text
[Deft]: http://jblevins.org/projects/deft/

View file

@ -18,6 +18,11 @@
:defer t
:init
(progn
(setq deft-extension "txt"
deft-text-mode 'org-mode
deft-use-filename-as-title t)
(evil-leader/set-key "an" 'spacemacs/deft)
(defun spacemacs/deft ()
"Helper to call deft and then fix things so that it is nice and works"
(interactive)
@ -26,16 +31,11 @@
(when (fboundp 'hungry-delete-mode)
(hungry-delete-mode -1))
;; When opening it you always want to filter right away
(evil-insert-state nil))
(evil-leader/set-key "an" 'spacemacs/deft)
)
(evil-insert-state nil)))
:config
(progn
(evil-leader/set-key-for-mode 'deft-mode
"m d" 'deft-delete-file
"m r" 'deft-rename-file
"m i" 'deft-toggle-incremental-search
"m n" 'deft-new-file)
(setq deft-extension "txt"
deft-text-mode 'org-mode
deft-use-filename-as-title t))))
"md" 'deft-delete-file
"mi" 'deft-toggle-incremental-search
"mn" 'deft-new-file
"mr" 'deft-rename-file))))