Remove hardcoded options, do repo house-cleaning
Update readme and tmux.session file. Remove unused tests, update option calling.
This commit is contained in:
parent
e95bcf53b4
commit
d29d92cc0a
6 changed files with 34 additions and 21 deletions
|
@ -7,7 +7,7 @@ select-pane -t 1
|
|||
split-window -v watch -t -n 1 -c '[ $(git diff --staged | wc -l) -eq 0 ] && git -c color.ui=always log --graph --date=short --decorate --oneline --all --remotes || git -c color.ui=always diff --staged | tail -n $(($LINES - 2))'
|
||||
select-pane -t 4
|
||||
new-window -n code
|
||||
send-keys "v ." C-m I
|
||||
send-keys "nvim --cmd "set rtp+=$(pwd)" ." C-m I
|
||||
split-window -v -l 10%
|
||||
send-keys "find . -type f -name '*.lua' | entr -c busted51 --exclude-tags='skip' --suppress-pending -C lua ." C-m
|
||||
split-window -h
|
||||
|
|
15
README.md
15
README.md
|
@ -5,9 +5,13 @@ To develop / debug:
|
|||
start neovim with `nvim --cmd "set rtp+=$(pwd)" .` to automatically load the files in project dir as if they were on path
|
||||
|
||||
next up:
|
||||
* [x] link following option (under cursor, next on line)
|
||||
* [x] next link on line function (actions)
|
||||
* [x] helper function to decide which one to use from A.open
|
||||
[ ] fix link following:
|
||||
* [x] empty space (e.g. in link text, or link itself) disrupts link regex search
|
||||
* [x] line-end following breaks if cursor is in the MIDDLE of the link
|
||||
* [ ] extract anchor from link/string (anchor.lua)
|
||||
* [ ] opening zettel should use generated link table for full filename anchor search
|
||||
* [ ] probably stop hardcoding anchor regex, make an option
|
||||
* [ ] implement fallback to filename
|
||||
|
||||
## TODO: needed functionality
|
||||
|
||||
|
@ -40,6 +44,7 @@ next up:
|
|||
## TODO: nice-to-haves
|
||||
|
||||
* [ ] refactor parsers (md/wiki) to be tables of functions/regex in options, so e.g. valid link detection can call `options.parser.isValidLink(link)` or transformation `options.parser.styleLink(anchor, text)`
|
||||
* [ ] use unified parser model (e.g. containing `turn-to-link()`, `parse-link()`) function
|
||||
* [ ] enable custom parser supply
|
||||
* [ ] completion engine (e.g. for `completion-nvim`, look in completion_buffers/completion-tags for reference)
|
||||
* [ ] zettel caching for big directories
|
||||
|
@ -53,6 +58,10 @@ next up:
|
|||
* [ ] provide option to rename and automatically change backlinks
|
||||
* [ ] zettel 'lens' (preview first headline + content of linked zettel through floating window etc, on keypress)
|
||||
|
||||
## TODO: maintenance
|
||||
|
||||
* [ ] remove hard-coding of option vimnames in tests, now that we can dynamically change this through a single table
|
||||
|
||||
* anchor creation
|
||||
* *must* be unique
|
||||
* default: 10 digits, usually current date+time (YYMMDDHHmm)
|
||||
|
|
|
@ -2,7 +2,8 @@ local ZK = {}
|
|||
|
||||
local ls = require 'zettelkasten.list'
|
||||
local o = require 'zettelkasten.options'
|
||||
local a = require 'zettelkasten.anchor'
|
||||
local anchor = require 'zettelkasten.anchor'
|
||||
local action = require 'zettelkasten.action'
|
||||
|
||||
-- Returns all zettel in path as a
|
||||
-- { "anchor" = "path/to/zettel/anchor filename.md" }
|
||||
|
@ -14,6 +15,13 @@ end
|
|||
|
||||
-- Return a valid zettelkasten anchor for the current time,
|
||||
-- composed of yymmddHHMM.
|
||||
function ZK.create_anchor() return a.create() end
|
||||
function ZK.get_anchor() return anchor.create() end
|
||||
|
||||
return {get_zettel_list = ZK.get_zettel_list, create_anchor = ZK.create_anchor}
|
||||
-- Open link under cursor, or next on line
|
||||
function ZK.open_link() return action.open_selected() end
|
||||
|
||||
return {
|
||||
get_zettel_list = ZK.get_zettel_list,
|
||||
get_anchor = ZK.get_anchor,
|
||||
open_link = ZK.open_link
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
ZK = require 'zettelkasten.init'
|
||||
|
||||
describe("Zettelkasten", function()
|
||||
it("should create an anchor for the current datetime",
|
||||
function() assert.same(os.date('%y%m%d%H%M'), ZK.create_anchor()) end)
|
||||
|
||||
end)
|
||||
-- describe("Zettelkasten", function()
|
||||
-- it("should create an anchor for the current datetime",
|
||||
-- function() assert.same(os.date('%y%m%d%H%M'), ZK.create_anchor()) end)
|
||||
-- end)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
local ls = {}
|
||||
|
||||
local o = require 'zettelkasten.options'
|
||||
|
||||
local function isDirectory(ftype)
|
||||
if ftype == 'directory' then return true end
|
||||
return false
|
||||
|
@ -12,8 +14,9 @@ function ls.get_anchors_and_paths(path, recursive, options)
|
|||
options = options or {}
|
||||
-- TODO check for duplicates and warn user
|
||||
local zettel = {}
|
||||
-- TODO let user set as option, at least remove magic var
|
||||
local anchorreg = '^.*/?([%d][%d][%d][%d][%d][%d][%d][%d][%d][%d])[^/]*%' ..
|
||||
(options.zettel_extension or '.md') .. '$'
|
||||
o.zettel().extension .. '$'
|
||||
|
||||
local handle = vim.loop.fs_scandir(path)
|
||||
while handle do
|
||||
|
@ -35,11 +38,10 @@ end
|
|||
-- Take a list of zettel as an optional variable, without which
|
||||
-- it will use the (recursive) results of the zettel_root directory.
|
||||
function ls.get_zettel(anchor, all)
|
||||
if not all then all = ls.get_anchors_and_paths('somepath') end
|
||||
-- TODO why is there 'somepath' here?
|
||||
if not all then all = ls.get_anchors_and_paths('/home/marty/documents/notes') end
|
||||
|
||||
return all[anchor]
|
||||
end
|
||||
|
||||
function ls.open_zettel(anchor, all) end
|
||||
|
||||
return ls
|
||||
|
|
|
@ -159,8 +159,3 @@ describe("get_zettel", function()
|
|||
assert.same("1910291645 myfile.wiki", ls.get_zettel("1910291645"))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("open_zettel", function()
|
||||
it("should set the current buffer to the zettel passed in as anchor",
|
||||
function() pending("not implemented") end)
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue