Advertisement
sbicknel

zettel.txt

Mar 15th, 2020
1,227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 12.36 KB | None | 0 0
  1. *vim-zettel.txt*    A Zettelkasten VimWiki Addon Last change: 2020 Mar 14
  2.  
  3.   _____    _   _       _ _             _                        
  4.  |__  /___| |_| |_ ___| | | _____  ___| |_ ___ _ __    
  5.    / // _ \ __| __/ _ \ | |/ / _ \/ __| __/ _ \ '_ \  
  6.  / /|  __/ |_| ||  __/ |   < (_| \__ \ ||  __/ | | |  
  7. /____\___|\__|\__\___|_|_|\_\__,_|___/\__\___|_| |_|  
  8.                                                        
  9.  
  10. ==============================================================================
  11. CONTENTS                                                           *vim-zettel*
  12.  
  13. 0. Intro                                     |Vim-Zettel-Intro|
  14. 1. Installation                              |Vim-Zettel-Install|
  15. 2. Configuration                             |Vim-Zettel-Configure|
  16. 3. Commands                                  |Vim-Zettel-Commands|
  17.    `ZettelNew`                                |Vim-Zettel_ZettelNew|
  18.    `ZettelCapture`                            |Vim-Zettel_ZettelCapture|
  19.    `ZettelBackLinks`                          |Vim-Zettel_ZettelBackLinks|
  20.    `ZettelInbox`                              |Vim-Zettel_ZettelInbox|
  21.    `ZettelGenerateLinks`                      |Vim-Zettel_ZettelGenerateLinks|
  22.    `ZettelGenerateTags`                       |Vim-Zettel_ZettelGenerateTags|
  23.    `ZettelSearch`                             |Vim-Zettel_ZettelSearch|
  24.    `ZettelYankName`                           |Vim-Zettel_ZettelYankName|
  25. 4. Mappings                                  |Vim-Zettel-Mappings|
  26.    `z`                                        |Vim-Zettel_z|
  27.    `[[`                                       |Vim-Zettel_[[|
  28.    `T`                                        |Vim-Zettel_T|
  29.    `gZ`                                       |Vim-Zettel_gZ|
  30. 5. Variables                                 |Vim-Zettel-Variables|
  31. 6. Templates                                 |Vim-Zettel-Templates|
  32. 7. Related Packages                          |Vim-Zettel-Related|
  33.  
  34. ==============================================================================
  35. 0. Intro                                                     *Vim-Zettel-Intro*
  36.  
  37. This is a Vim plugin that implements ideas of the zettelkasten method of
  38. note taking as described at https://zettelkasten.de/.  It is an add-on to
  39. the Vimwiki extension for Vim and supports both Vimwiki and Markdown syntaxes.
  40.  
  41. ==============================================================================
  42. 1. Installation                                           *Vim-Zettel-Install*
  43.  
  44. This extension requires an external search utility.  It uses The Silver
  45. Searcher by default.
  46. (Available at https://github.com/ggreer/the_silver_searcher/ or in your OS
  47. repositories).
  48.  
  49. Using Vundle: >
  50.  
  51.    Plugin 'vimwiki/vimwiki'
  52.    Plugin 'junegunn/fzf'
  53.    Plugin 'junegunn/fzf.vim'
  54.    Plugin 'michal-h21/vim-zettel'
  55. <
  56. ==============================================================================
  57. 2. Configuration                                        *Vim-Zettel-Configure*
  58.  
  59. First of all, it is necessary to configure Vimwiki, as Vim-zettel builds
  60. on top of it.  Vim-Zettel can be used out of the box without further
  61. configuration if you have only one wiki.  However, you will probably want to
  62. customize your Vim-Zettel configuration and will have to if you have more than
  63. one wiki. >
  64.  
  65.    " Settings for Vimwiki
  66.    let g:vimwiki_list = \
  67.      [{'path':'~/scratchbox/vimwiki/markdown/','ext':'.md',\
  68.      'syntax':'markdown'}, {"path":"~/scratchbox/vimwiki/wiki/"}]
  69.  
  70. You may want to set some of the following options in your .vimrc file to make
  71. Vim-Zettel work to your liking:
  72.  
  73. - |g:zettel_options|
  74. - |g:zettel_format|
  75. - |g:zettel_default_mappings|
  76. - |g:zettel_fzf_command|
  77.  
  78. You can also supply a custom template for creating new zettels. See
  79. |Vim-Zettel-Templates|.
  80.  
  81. ==============================================================================
  82. 3. Commands                                              *Vim-Zettel-Commands*
  83.  
  84. Vim-Zettel implements the following commands on top of Vimwiki.
  85.  
  86.                                                        *Vim-Zettel_ZettelNew*
  87.                                                                   *ZettelNew*
  88. - `:ZettelNew` command – it will create a new wiki file named as
  89.  %y%m%d-%H%M.wiki (it is possible to change the file name format using
  90.  g:zettel_format variable). The file uses basic template in the form >
  91.  
  92.    %title Note title
  93.    %date current date
  94.  
  95. where title is the first parameter to `:ZettelNew`.
  96.  
  97.                                                    *Vim-Zettel_ZettelCapture*
  98.                                                               *ZettelCapture*
  99. - `:ZettelCapture` command – turn the content of the current file into a
  100.    zettel.  This is a global command available throughout Vim. WARNING:
  101.    this command is destructive. Use only on temporary files.  You can run
  102.    this from within vim while viewing a file you want to turn into a zettel
  103.    or from the command line: >
  104.    
  105.        vim -c ZettelCapture filename
  106. <
  107.                                                  *Vim-Zettel_ZettelBackLinks*
  108.                                                             *ZettelBackLinks*
  109. - `:ZettelBackLinks` command – insert list of notes that link to the current
  110.    note.
  111.  
  112.                                                      *Vim-Zettel_ZettelInbox*
  113.                                                                 *ZettelInbox*
  114. - `:ZettelInbox` command – insert list of notes that no other note links to.
  115.  
  116.                                              *Vim-Zettel_ZettelGenerateLinks*
  117.                                                         *ZettelGenerateLinks*
  118. - `:ZettelGenerateLinks` command – insert list of all wiki pages in the
  119.    current page. It needs updated tags database. The tags database can be
  120.    updated  using the `:VimwikiRebuildTags!` command.
  121.  
  122.                                               *Vim-Zettel_ZettelGenerateTags*
  123.                                                          *ZettelGenerateTags*
  124. - `:ZettelGenerateTags` command – insert list of tags and pages that used
  125.    these tags in the current page. It needs updated tags database. The tags
  126.    database can be updated  using the `:VimwikiRebuildTags!` command. It only
  127.    supports the Vimwiki style tags in the form :tag1:tag2. These work
  128.    even in the Markdown mode.
  129.    
  130.                                                    *Vim-Zettel_ZettelSearch*
  131.                                                               *ZettelSearch*
  132. - `:ZettelSearch` command – search the content of your zettelkasten and
  133.    insert a link to the selected zettel in your current note.  Mapped to
  134.    `[[` in insert mode.
  135.    
  136.                                                  *Vim-Zettel_ZettelYankName*
  137.                                                             *ZettelYankName*
  138. - `:ZettelYankName` – copy the current zettel file name and title as a
  139.    formatted link.  Mapped to `T` in normal mode.
  140.  
  141. Useful Vimwiki commands ~
  142.  
  143. - |:VimwikiBacklinks| - display files that link to the current page
  144. - |:VimwikiCheckLinks|- display files that no other file links to
  145.  
  146. ==============================================================================
  147. 4. Mappings                                               *Vim-Zettel-Mappings*
  148.  
  149.                                                                *Vim-Zettel_z*
  150. - `z` command in visual mode – create a new wiki file using selected text for
  151.    the note title
  152.  
  153.                                                               *Vim-Zettel_[[*
  154. - [[ command in insert mode – create a link to a note. It uses FZF for the
  155.    note searching.
  156.  
  157.                                                                *Vim-Zettel_T*
  158. - T command in normal mode – yank the current note filename and title as a
  159.    Vimwiki link
  160.  
  161.                                                               *Vim-Zettel_gZ*
  162. - gZ command in normal mode – replace file path under cursor with Wiki link
  163.  
  164. It may be convenient to map `ZettelNew` to prompt for a note title also: >
  165.  
  166.    nnoremap <leader>zn :ZettelNew<space>
  167. <
  168. ==============================================================================
  169. 5. Variables                                             *Vim-Zettel-Variables*
  170.  
  171.                                                            *g:zettel_options*
  172. The g:zettel_options variable corresponds to the g:vimwiki_list variable.  If
  173. you have more than one vimwiki and the second wiki listed in your
  174. g:vimwiki_list variable is your zettelkasten, then you must represent the
  175. first wiki in your g:zettel_options list as a set of empty braces: >
  176.  
  177.                    first wiki     zettelkasten wiki
  178.                             ↓     ↓
  179.    let g:zettel_options = ['{}', '{"front_matter" : {"tags" : ""}, "template" :  "~/mytemplate.tpl"}']
  180. <
  181.                                                             *g:zettel_format*
  182. By default, Vim-zettel creates filenames in the form YYMMDD-HHMM. This
  183. format can be changed using the g:zettel_format variable. Any date and time
  184. formats supported by the `strftime()` function.
  185.  
  186. It is also possible to use other formatting strings:
  187.  
  188. - %title -- insert sanitized title
  189. - %raw_title -- insert raw title
  190. - %file_no -- sequentially number files in wiki
  191. - %file_alpha -- sequentially number files in wiki, but use characters
  192.    instead of numbers
  193.  
  194. To use filename based on current time and note title, you can use the
  195. following format: >
  196.  
  197.    let g:zettel_format = "%y%m%d-%H%M-%title"
  198.  
  199. For sequentialy named files use: >
  200.  
  201.    let g:zettel_format = "%file_no"
  202.  
  203.                                                   *g:zettel_default_mappings*
  204. The default mappings used by Vim-Zettel can be changed by setting the
  205. g:zettel_default_mappings variable to 0 and then prividing your own keymaps.
  206. The code below can serve as a template to start from. >
  207.  
  208.    let g:zettel_default_mappings = 0
  209.    " This is basically the same as the default configuration
  210.    augroup filetype_vimwiki
  211.      autocmd!
  212.      autocmd FileType vimwiki imap <silent> [[ [[<esc><Plug>ZettelSearchMap
  213.      autocmd FileType vimwiki nmap T <Plug>ZettelYankNameMap
  214.      autocmd FileType vimwiki xmap z <Plug>ZettelNewSelectedMap
  215.      autocmd FileType vimwiki nmap gZ <Plug>ZettelReplaceFileWithLink
  216.    augroup END
  217.  
  218.                                                        *g:zettel_fzf_command*
  219. Vim-Zettel uses The Silver Searcher (ag) by default when searching through
  220. your files.  The g:zettel_fzf_command can be used to override the default
  221. setting. >
  222.  
  223.    " command used for VimwikiSearch
  224.    " default value is "ag". To use other command, like ripgrep, pass the
  225.    " command line and options:
  226.    let g:zettel_fzf_command = "rg --column --line-number --ignore-case \
  227.      --no-heading --color=always "
  228.      
  229. ==============================================================================
  230. 6. Templates                                             *Vim-Zettel-Templates*
  231.  
  232. It is possible to populate new notes with basic structure using templates.
  233. Template can be declared using the g:zettel_options variable: >
  234.  
  235.    let g:zettel_options = [{"template" :  "~/path/to/mytemplate.tpl"}]
  236.  
  237. Sample template: >
  238.  
  239.    = %title =
  240.    
  241.    Backlink: %backlink
  242.    ----
  243.    %footer
  244.  
  245. Variables that start with the % will be expanded. Supported variables:
  246.  
  247. - %title - title of the new note
  248. - %backlink - back link to the parent note
  249. - %footer - text from the parent note footer. Footer is separated from  the
  250.  main text by horizontal rule  (----). It can contain some information
  251.  shared by notes. For example notes about publication can share citation of
  252.  that publication.
  253.  
  254. ==============================================================================
  255. 7. Related packages                                        *Vim-Zettel-Related*
  256.  
  257. The following packages may be useful in conjunction with Vimwiki and
  258. Vim-zettel:
  259.  
  260. - [Notational FZF](https://github.com/alok/notational-fzf-vim) - fast
  261.    searching notes with preview window.
  262.  
  263.    To search in the Zettelkasten, set the following variable with path to the
  264.    Zettelkaster direcory in .vimrc: >
  265.  
  266.        let g:nv_search_paths = ['/path/to/zettelkasten/dir']
  267.  
  268. - [Vimwiki-sync](https://github.com/michal-h21/vimwiki-sync) - automatically
  269. commit changes in wiki and synchronize them with external Git repository.
  270.  
  271.  
  272. vim:tw=78:ts=8:ft=help
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement