Commit graph

18 commits

Author SHA1 Message Date
2ff3a0b299
Move functions working on buffer text to own module 2021-05-03 23:21:58 +02:00
4e3d364d17
Add word under cursor and (manual) mode selection 2021-05-03 23:02:59 +02:00
2310f4a2d0
Implement initial selection link creation 2021-05-03 17:31:28 +02:00
7c6882ac16
Rename imports and local vars to unify more 2021-05-03 17:29:42 +02:00
3f3e5ec7c2
Remove bignumber allocation, refactor open function
Switched out manual BIGNUMBER creation for the lua inbuilt `math.huge`.
Refactored `open_selected` a tiny bit in preparation for automatic link
creation.
2021-04-30 17:32:03 +02:00
fdcb0f2a93
Add opening zettel by reference if no anchor found
Opens zettel by linked value, most often a direct path link, but will
also look through the root dir to find a(n exactly) matching basename to
open.

If nothing is found in the root dir will open a new file to write with
the corresponding name. Careful, if the reference is a full path
definition, and the file does not exist, it will still open the
corresponding file at the correct location but when attempting to save
will generally complain if parts of the path are missing. They have to
be created manually or in some other place, this is outside the scope of
this plugin.
2021-04-30 16:30:52 +02:00
4aa9d98818
Add Zettel ref getting defaulting to root dir 2021-04-30 16:10:35 +02:00
325be3c500
Split zettel getting into by anchor and by ref
Prepare for creating a lookup of zettels through the root directory by
file name as well as zettel id.
2021-04-30 15:52:54 +02:00
9dcd2556ba
Rename list module to files module
Renamed to 'files.lua' since it is the only module actively working on
the underlying filesystem so far -- gathering existing files and zettel
in the directories.
2021-04-30 15:30:43 +02:00
5a0a258658
Fix local variable overwrites 2021-04-30 13:26:40 +02:00
93a1dfbae4
Add zettel opening by anchor 2020-11-06 17:28:05 +01:00
30e0519a1f
Refactor action open_selected function 2020-11-06 16:44:55 +01:00
101a15c8c9
Refactor link options into their own category 2020-11-06 16:01:51 +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
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