Πρωτεσίλαος built the note-taking tool denote for Emacs. In essence, denote is a straightforward and handy file-naming scheme for all kinds of files. This, e.g., allows altering the title of a note without breaking the web of links.
The present vim package reproduces some of the denote features for vim. The implementation is not complete, and more features are expected. Note that this is not the first attempt to handle denote notes within vim. Conan developed a bash script for denote and an accompanying vim plugin. Also Ashton built such a plugin.
Why?
The present package aims at handling denote notes the vim way. For instance, both plugins do not bind the default key combination |gf| to follow links. The vim option |'includeexpr'|, however, exists precisely for solving the problem at hand: following custom-made links.
Also, the present package aims at remaining flexible.
Again, both plugins require the denote note identifiers to follow the rigid
format YYYYMMDDTHHMMSS. Per denote manual, the identify may be any
string
(free of field delimiters, of course).
Installation
You may use any of your favorite plugin managers, or, place a copy of this
package in ~/.vim/pack/tools/start.
Usage
For following links, simply move your cursor to the denote link, and press
gf.
Browsing and searching notes is implemented using the location
list.
So, after running any of the following commands, you may navigate your notes
using, e.g., :lopen to open the list, :lnext and :lprev, to move to the next or
previous entry (the list does not need to be opened for that), and :lclose
for closing the location list.
Commands
This package defines the following user commands:
-
:Denote [{keyword ..}]: This command places all denote entries in the location list. You may supply any number of arguments to filter the notes by the given keywords. -
:DenoteTag {tag}: With this, all notes of a given tag are listed. The{tag}may be autocompleted by hitting the tab key. -
:DenoteGrep /{pattern}/[g][j][f]: This command builds around :vimgrep and can be used to search for patterns within your notes. -
:DenoteBackReferences: With this, you may populate the location list with all links to the currently opened note.
Key mappings
This package also defines the following interface for key mappings, which automatically open the location window:
<Plug>DenoteListto list all denote notes, and<Plug>DenoteBackReferencesto list all back references.
So, you may want to configure your keys like this:
nnoremap <silent> <Leader>d <Plug>DenoteList;
nnoremap <silent> <Leader>D <Plug>DenoteBackReferences;
You may also find the following keys favorable for navigation:
nnoremap ]l :lnext<CR>
nnoremap [l :lprevious<CR>
Customization
You can customize the behavior of this package using the following two global
variables. The variable g:denote_note_file_extensions defaults to ['md', 'org'] and lists the file extensions in which :DenoteGrep will look for the
given pattern. The other variable g:denote_loc_title_columns defaults to 40
and specifies the number of columns used to display the titles of your notes.
Future features
These features are planned:
- Note creation (and deletion?)
- Tag manipulation
- Title manipulation
- Signature handling?