diff --git a/README.md b/README.md index 419e3d6..da08b27 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,9 @@ Somewhere in your vim config, put a snippet like this: ```vimscript lua << END +local home = vim.fn.expand("~/zettelkasten") require('telekasten').setup({ - home = vim.fn.expand("~/zettelkasten"), + home = home dailies = vim.fn.expand("~/zettelkasten/daily"), weeklies = vim.fn.expand("~/zettelkasten/weekly"), extension = ".md", @@ -50,13 +51,13 @@ require('telekasten').setup({ weeklies_create_nonexisting = true, -- template for new notes (new_note, follow_link) - template_new_note = ZkCfg.home .. '/' .. 'templates/new_note.md', + template_new_note = home .. '/' .. 'templates/new_note.md', -- template for newly created daily notes (goto_today) - template_new_daily = ZkCfg.home .. '/' .. 'templates/daily.md', + template_new_daily = home .. '/' .. 'templates/daily.md', -- template for newly created weekly notes (goto_thisweek) - template_new_weekly= ZkCfg.home .. '/' .. 'templates/weekly.md', + template_new_weekly= home .. '/' .. 'templates/weekly.md', }) END ``` diff --git a/lua/telekasten.lua b/lua/telekasten.lua index f64f618..fa4986a 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -10,35 +10,38 @@ local vim = vim -- ---------------------------------------------------------------------------- -- DEFAULT CONFIG -- ---------------------------------------------------------------------------- +local home = vim.fn.expand("~/zettelkasten") + ZkCfg = { - home = vim.fn.expand("~/zettelkasten"), - dailies = vim.fn.expand("~/zettelkasten/daily"), - weeklies = vim.fn.expand("~/zettelkasten/weekly"), - extension = ".md", - daily_finder = "daily_finder.sh", + home = home, + dailies = vim.fn.expand("~/zettelkasten/daily"), + weeklies = vim.fn.expand("~/zettelkasten/weekly"), + extension = ".md", + daily_finder = "daily_finder.sh", - -- where to install the daily_finder, - -- (must be a dir in your PATH) - my_bin = vim.fn.expand('~/bin'), + -- where to install the daily_finder, + -- (must be a dir in your PATH) + my_bin = vim.fn.expand('~/bin'), - -- download tool for daily_finder installation: curl or wget - downloader = 'curl', - -- downloader = 'wget', -- wget is supported, too + -- download tool for daily_finder installation: curl or wget + downloader = 'curl', + -- downloader = 'wget', -- wget is supported, too - -- following a link to a non-existing note will create it - follow_creates_nonexisting = true, - dailies_create_nonexisting = true, - weeklies_create_nonexisting = true, + -- following a link to a non-existing note will create it + follow_creates_nonexisting = true, + dailies_create_nonexisting = true, + weeklies_create_nonexisting = true, - -- templates for new notes - template_new_note = ZkCfg.home .. '/' .. 'templates/new_note.md', - -- currently unused, hardcoded in daily_finder.sh: - template_new_daily = ZkCfg.home .. '/' .. 'templates/daily_tk.md', - -- currently unused - template_new_weekly= ZkCfg.home .. '/' .. 'templates/weekly_tk.md', + -- templates for new notes + template_new_note = home .. '/' .. 'templates/new_note.md', + template_new_daily = home .. '/' .. 'templates/daily_tk.md', + template_new_weekly = home .. '/' .. 'templates/weekly_tk.md', } + -- ---------------------------------------------------------------------------- + + local downloader2cmd = { curl = 'curl -o', wget = 'wget -O',