Commit graph

9 commits

Author SHA1 Message Date
Marty Oehme e4e6fca765
Fix unused variables and useless pending test 2021-04-30 13:28:00 +02:00
Marty Oehme 162057f149
Add configurable zettel root directory
Plugin will by default recursively look in this directory for any
zettel.
2020-11-06 16:44:55 +01:00
Marty Oehme 101a15c8c9
Refactor link options into their own category 2020-11-06 16:01:51 +01:00
Marty Oehme 65e3b0bc1c
Add anchor regex ceontent as changeable option 2020-11-06 15:46:33 +01:00
Marty Oehme 587fa47268
Refactor option setting with defaults
Now reads from an existing defaults table, which has the required keys:

'vimname', the setting name in vim itself (for the user)
'default', the value it should contain by default

and the optional key

'valid', if the option should be restricted to a certain valid value set
2020-11-04 15:17:58 +01:00
Marty Oehme 59574a17e9
Add zettel link following style option
`g:zettel_link_following` can be set to `cursor` or `line` to change the
way zk detect the closest link to follow to (or create a new link for).

Setting it to `cursor` will look for the current word under the cursor and
decide if it is a followable link. `line` will look from the current
cursor position to the end of the line instead.
2020-11-01 22:18:40 +01:00
Marty Oehme 1742b74d5a
Refactor restricted option sets
Added utility function must_contain which will crawl through a set and
emit an error if the value is not contained in it.
2020-10-30 19:08:52 +01:00
Marty Oehme 78a1948545
Add link formatting function
Function takes an anchor (and optional link text and formatting style)
and transforms the input into a link to an anchor id.

Currently works for markdown and wikilink style link transforms.
2020-10-30 18:44:50 +01:00
Marty Oehme ece30350c2
Refactor options to separate file
Options were previously set ad-hoc in the initialize function, but
re-set and overwritten at various places.

Options now live in one central module (options.lua), where they
directly access the neovim options set, and re-access them on any run.

That means options can be changed while the plugin is running and it
will use their newer versions, without requiring any re-initialization.
2020-10-30 16:04:23 +01:00