ZK, NVIM and Misc

Add ZK config, template and script.
Add various Neovim plugins, and some markdown specific settings.
Add Neovim aliases.
Fix 100% in alsa luastatus plugin.
This commit is contained in:
venomade committed 2026-02-13 18:09:22 +00:00
1 parent 0bd1501855
commit 4b8cc0b9a9
14 files changed
+266 -109

No files matched your search

+6 -98
View File
@@ -1,101 +1,9 @@
#!/usr/bin/env lua
#!/usr/bin/env sh
local HOME = os.getenv("HOME")
local NOTES = HOME .. "/Documents/Notes"
local TERM = "foot -a=floating_foot"
local EDITOR = "nvim"
note_list=$(zk list -f "{{ title }}" -d $'\n' -q)
local MODE = arg[1] -- nil | "--delete" | "-d"
selected=$(printf "%s\n" "$note_list" | rofi -dmenu -i -p "󱞁 ")
local function rofi(prompt, lines)
local cmd = string.format(
'printf "%s" | rofi -dmenu -i -p "%s"',
table.concat(lines, "\n"),
prompt
)
local handle = io.popen(cmd)
local selection = handle:read("*a")
handle:close()
selection = selection:gsub("%s+$", "")
if selection == "" then return nil end
return selection
end
local function list_notes()
local display = {}
local lookup = {}
local cmd = string.format('find "%s" -type f', NOTES)
local pipe = assert(io.popen(cmd, "r"))
for fullPath in pipe:lines() do
local relPath = fullPath:gsub("^" .. NOTES .. "/", "")
local noteName = relPath:gsub("%.[^./]*$", "")
table.insert(display, noteName)
lookup[noteName] = fullPath
end
pipe:close()
return display, lookup
end
local function normalize_path(input)
input = input:gsub("^/", "")
if not input:match("%.md$") then
input = input .. ".md"
end
return NOTES .. "/" .. input
end
local function ensure_parent_dir(path)
local dir = path:match("(.+)/[^/]+$")
if dir then
os.execute(string.format('mkdir -p "%s"', dir))
end
end
local function open_in_nvim(path)
local cmd = string.format(
'%s -e %s "%s"',
TERM,
EDITOR,
path
)
os.execute(cmd)
end
local function delete_note(path, name)
local confirm = rofi("Delete " .. name .. "?", { "No", "Yes" })
if confirm == "Yes" then
os.execute(string.format('rm -- "%s"', path))
end
end
-- ---- main ----
local notes, paths = list_notes()
if MODE == "--delete" or MODE == "-d" then
local choice = rofi(" ", notes)
if not choice then os.exit(0) end
local path = paths[choice]
if path then
delete_note(path, choice)
end
os.exit(0)
end
-- default: open / create
local choice = rofi(" ", notes)
if not choice then os.exit(0) end
local path = paths[choice]
if not path then
path = normalize_path(choice)
ensure_parent_dir(path)
end
open_in_nvim(path)
if [[ -n $selected ]]; then
foot -a=floating_foot -e sh -c "zk edit --match \"${selected}\""
fi