diff --git a/README.md b/README.md index 95a84e3..349ce90 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,22 @@ correctly from visual mode. The functions are again exposed as `zettel_link_open` and `zettel_link_make` respectively. +### Index ```vim +nnoremap w :lua require 'zettelkasten'.open_index() ``` +allows you to map going to your defined zettel index file. +This functions by looking into your zettel directory for a file named +'index' and ending with the extension you set for your zettel. +I.e. by default it will open 'index.md' in your zettel root directory. + +If you wish to open a different file by default, you can pass it into the +lua function as a string, e.g. `:lua require 'zettelkasten'.open_index('myfile')`, +though it will keep adding the zettel extension at the end. + +Indexing is also exposed as vim mapping `zettel_index_open` ### Listing diff --git a/plugin/zettelkasten.vim b/plugin/zettelkasten.vim index 223cafd..e0ff01d 100644 --- a/plugin/zettelkasten.vim +++ b/plugin/zettelkasten.vim @@ -10,4 +10,6 @@ vnoremap zettel_link_make :lua require 'zettelkasten'.make_link(true) nnoremap zettel_link_follow :lua require 'zettelkasten'.open_or_make_link() vnoremap zettel_link_follow :lua require 'zettelkasten'.open_or_make_link(true) +nnoremap zettel_index_open :lua require 'zettelkasten'.open_index() + let g:loaded_zettelkasten = 1