Commit graph

9 commits

Author SHA1 Message Date
Marty Oehme 5a0a258658
Fix local variable overwrites 2021-04-30 13:26:40 +02:00
Marty Oehme 93a1dfbae4
Add zettel opening by anchor 2020-11-06 17:28:05 +01:00
Marty Oehme 30e0519a1f
Refactor action open_selected function 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 2a3e213ac8
Move link extraction to link module
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.
2020-11-04 22:04:31 +01:00
Marty Oehme 3a9e04d3ce
Refactor open actions
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.
2020-11-04 21:37:16 +01:00
Marty Oehme ba033e2b24
Add function to search for next link on line
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.
2020-11-02 21:51:14 +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 aef7d29997
Add action module
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)
2020-10-31 14:17:26 +01:00