Unified handling of local / global variables

This commit is contained in:
Lüdecke Sascha
2026-08-07 09:13:07 +02:00
parent d8d0c45bc3
commit 83b45009e3
5 changed files with 11 additions and 10 deletions

View File

@@ -1,7 +1,9 @@
local DIARY_FOLDER = vim.fs.joinpath(vim.env.HOME, '.diary/asciidoc')
local diary_open = function(opts)
local date = opts.args ~= '' and opts.args or os.date('%Y-%m-%d')
local year, month = date:match('(%d%d%d%d)-(%d%d)')
local folder = vim.fs.joinpath(vim.env.HOME, string.format('.diary/asciidoc/%s', year))
local folder = vim.fs.joinpath(DIARY_FOLDER, string.format('%s', year))
vim.fn.mkdir(folder, "p")
local file = string.format('%s/diary-%s-%s.adoc', folder, year, month)
print("file is:", file)