Renormalized + itronb adjustments

This commit is contained in:
Lüdecke Sascha
2026-03-23 15:09:06 +01:00
parent 2b47d7a9cd
commit fd5c73f099
25 changed files with 2143 additions and 2102 deletions

View File

@@ -1,24 +1,24 @@
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))
vim.fn.mkdir(folder, "p")
local file = string.format('%s/diary-%s-%s.adoc', folder, year, month)
print("file is:", file)
vim.cmd('e ' .. file)
vim.cmd('normal! G') -- go to end of file
-- NOTE.2025-06-08 [1] and [2] should be replaced with snippet name, but I
-- don't know how -- neither do grok nor chatgpt ...
local snips = require('luasnip')
local asnippets = snips.get_snippets('asciidoc')
if vim.fn.getfsize(file) == 0 then
snips.snip_expand(asnippets[1])
vim.cmd('normal! G')
end
vim.cmd('normal! 3o') -- insert some newlines before new entry
snips.snip_expand(asnippets[2])
end
vim.api.nvim_create_user_command("Diary", diary_open, { nargs = '?' })
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))
vim.fn.mkdir(folder, "p")
local file = string.format('%s/diary-%s-%s.adoc', folder, year, month)
print("file is:", file)
vim.cmd('e ' .. file)
vim.cmd('normal! G') -- go to end of file
-- NOTE.2025-06-08 [1] and [2] should be replaced with snippet name, but I
-- don't know how -- neither do grok nor chatgpt ...
local snips = require('luasnip')
local asnippets = snips.get_snippets('asciidoc')
if vim.fn.getfsize(file) == 0 then
snips.snip_expand(asnippets[1])
vim.cmd('normal! G')
end
vim.cmd('normal! 3o') -- insert some newlines before new entry
snips.snip_expand(asnippets[2])
end
vim.api.nvim_create_user_command("Diary", diary_open, { nargs = '?' })