Commit graph

34 commits

Author SHA1 Message Date
93a1dfbae4
Add zettel opening by anchor 2020-11-06 17:28:05 +01:00
382b0bef72
Add anchor extraction to link string extraction 2020-11-06 16:52:57 +01:00
30e0519a1f
Refactor action open_selected function 2020-11-06 16:44:55 +01:00
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
20a1eef2e4
Remove undocument and unused options parameter 2020-11-06 16:12:00 +01:00
101a15c8c9
Refactor link options into their own category 2020-11-06 16:01:51 +01:00
44a985cce6
Add anchor extraction function
`anchor.extract(string, anchor)` will find and extract a zettel anchor
from any string passed in.

It can be given an optional anchor regex which will supersede any regex
set in the plugin options.
2020-11-06 15:53:01 +01:00
65e3b0bc1c
Add anchor regex ceontent as changeable option 2020-11-06 15:46:33 +01:00
d29d92cc0a
Remove hardcoded options, do repo house-cleaning
Update readme and tmux.session file.

Remove unused tests, update option calling.
2020-11-04 22:27:30 +01:00
e95bcf53b4
Refactor link creation into parser style_func 2020-11-04 22:16:21 +01:00
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
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
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
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
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
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
972845505f
Add new link functionality
`link.new` will create a correctly formatted to link for a zettel which
does *not exist* yet, by adding its own anchor.
2020-10-31 11:37:55 +01:00
9f1a7eb5ad
Fix link creation failing on empty text 2020-10-31 11:12:37 +01:00
320007e14b
Move anchor prepend function to anchor module 2020-10-31 11:05:30 +01:00
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
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
aa3e1eb754
Refactor link cleaning and transformation functions 2020-10-30 18:21:04 +01:00
cac9720d35
Refactor anchor and link functions into files 2020-10-30 16:30:37 +01:00
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
e96b454b23
Add simple zettel retrieval function 2020-10-30 13:48:17 +01:00
313ad0b60c
Refactor list tests to directly use list api 2020-10-29 20:13:02 +01:00
441cbcbc63
Fix zettel listing obeying zettel extension option 2020-10-29 19:09:56 +01:00
e5afcb5e15
Reformat lua code with lua-format 2020-10-29 19:00:23 +01:00
a365cef6c7
Move intended features to README 2020-10-29 18:41:05 +01:00
1c44f244e4
Refactor list functions and options
Moved list functionality into separate file list.lua.
Moved zettelkasten options from local variables to table-scoped
variables, initialized in ZK.init().
2020-10-29 18:17:00 +01:00
72f84898f0
Add recursive file listing 2020-10-29 15:22:51 +01:00
7e77b616ea
Add simple anchor listing functionality 2020-10-29 12:18:19 +01:00
c7236ad295
Add Datestamp and Link creation functionality 2020-10-26 19:32:27 +01:00
86ab71b1d6
Initial commit 2020-10-26 15:55:40 +01:00