This is a Vim plugin that implements ideas of the Zettelkasten method using Vimwiki. This is a work in progress and it has just a basic features ATM. It supports both Vimwiki and Markdown syntaxes.
Using Vundle:
Plugin 'vimwiki/vimwiki'
Plugin 'junegunn/fzf.vim'
Plugin 'michal-h21/vim-zettel'
Sample configuration:
" Filename format. The filename is created using strftime() function
let g:zettel_format = "%y%m%d-%H%M"
" Disable default keymappings
let g:zettel_default_mappings = 0
" This is basically the same as the default configuration
augroup filetype_vimwiki
autocmd!
autocmd FileType vimwiki imap <silent> [[ [[<esc><Plug>ZettelSearchMap
autocmd FileType vimwiki nmap T <Plug>ZettelYankNameMap
autocmd FileType vimwiki xmap z <Plug>ZettelNewSelectedMap
autocmd FileType vimwiki nmap gZ <Plug>ZettelReplaceFileWithLink
augroup END
" Settings for Vimwiki
let g:vimwiki_list = [{'path':'~/scratchbox/vimwiki/markdown/','ext':'.md','syntax':'markdown', 'zettel_template': "~/mytemplate.tpl"}, {"path":"~/scratchbox/vimwiki/wiki/"}]
" Set template and custom header variable for the second Wiki
let g:zettel_options = [{},{"front_matter" : {"tags" : ""}, "template" : "~/mytemplate.tpl"}]
It adds some commands and mappings on top of Vimwiki. See it's documentation on how to set up a basic wiki and navigate it.
-
:ZettelNew
command - it will create a new wiki file named as%y%m%d-%H%M.wiki
(it is possible to change the file name format usingg:zettel_format
variable). The file uses basic template in the form%title Note title %date current date
-
z
command in the visual mode - create a new wiki file using selected text for the note title -
[[
command in the insert mode - create a link to a note. It uses FZF for the note searching. -
T
command in the normal mode - yank the current note filename and title as a Vimwiki link -
gZ
command in the normal mode - replace file path under cursor with Wiki link -
:ZettelCapture
- create a new Zettel from a file. Useful for scripting. It can be used in this wayvim -c ZettelCapture filename
It will replace the original file contents with a path to the new wiki file, so it should be used with temporary files!
The following packages may be useful in conjunction with Vimwiki and Vim-zettel:
- Notational FZF - fast searching notes with preview window.
- Vimwiki-sync - automatically commit changes in wiki and synchronize them with external Git repository.