Rename index opening function

Renamed function to fit in line with other exposed lua API, putting
object before action, i.e. zettel_index_open instead of open_index.
This commit is contained in:
Marty Oehme 2021-10-20 16:38:58 +02:00
parent fc54052d2c
commit bd2481d41e
Signed by: Marty
GPG Key ID: B7538B8F50A1C800
2 changed files with 14 additions and 0 deletions

View File

@ -49,10 +49,22 @@ correctly from visual mode.
The functions are again exposed as `<Plug>zettel_link_open` and
`<Plug>zettel_link_make` respectively.
### Index
```vim
nnoremap <leader>w :lua require 'zettelkasten'.open_index()<cr>
```
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 `<Plug>zettel_index_open`
### Listing

View File

@ -10,4 +10,6 @@ vnoremap <Plug>zettel_link_make :lua require 'zettelkasten'.make_link(true)<cr>
nnoremap <Plug>zettel_link_follow :lua require 'zettelkasten'.open_or_make_link()<cr>
vnoremap <Plug>zettel_link_follow :lua require 'zettelkasten'.open_or_make_link(true)<cr>
nnoremap <Plug>zettel_index_open :lua require 'zettelkasten'.open_index()<cr>
let g:loaded_zettelkasten = 1