Both link creation and extraction, all derived from parser
functionality, should run within the link module and actions should only
make use of it to invoke editor functionality.
Open actions now make use of a 'link' data structure containing a text
and ref string, and the respective start and end positions on the line.
Additionally, parsers are now simple objects containing extraction regex
for extracting their text and ref link individually.
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
By choosing 'line' in the `zettel_link_following` option, the link to be
opened will be searched for on the complete rest of the line, meaning
from the cursor to the newline symbol onwards.
`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.
Action module contains the interactions the user can take directly with
the zettelkasten, and which in turn act on the editor.
First action to be taken is the opening of zettel links.
`action.open(mytext)` allows the user to pass in a md/wikilink-formatted
string from which the function will open the first found in the current
buffer.
`action.open_selected()` does the same, but looks at the cursor context
to get its string (the link under current cursor position as of now; in
the future probably also the next link on current line, and the first
link in visual selection)
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.
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.
Moved list functionality into separate file list.lua.
Moved zettelkasten options from local variables to table-scoped
variables, initialized in ZK.init().