summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-06-24 10:29:16 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-06-24 17:02:51 +0200
commitbb02d0dc5f80c76e81da91855d49264d5c854b53 (patch)
tree360f11ed5aab13a9087fc3bdb67e4060ed000bb9 /plugin
parenta94222cb63b7249304080842c6044c72bdd02c54 (diff)
downloadnvim-config-bb02d0dc5f80c76e81da91855d49264d5c854b53.tar.gz
nvim-config-bb02d0dc5f80c76e81da91855d49264d5c854b53.zip
misc: open notes index on NotesOpen
Diffstat (limited to 'plugin')
-rw-r--r--plugin/50-notes.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugin/50-notes.lua b/plugin/50-notes.lua
index de66679..f128447 100644
--- a/plugin/50-notes.lua
+++ b/plugin/50-notes.lua
@@ -428,9 +428,16 @@ local function find_notes_by_grep()
require("fzf-lua").live_grep({ cwd = notes_dir })
end
+-- Enters the notes dir and opens its index, creating it with a `# Index` header on first use.
local function open_notes()
vim.cmd.cd(notes_dir)
- vim.cmd.NotesFindTags()
+ local index = notes_dir .. "/index.md"
+ if not vim.uv.fs_stat(index) then
+ local f = assert(io.open(index, "w"))
+ f:write("# Index\n")
+ f:close()
+ end
+ vim.cmd.edit({ args = { index } })
end
----------------------------------------------------------------------------------------------------