summaryrefslogtreecommitdiffstats
path: root/plugin/50-notes.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/50-notes.lua')
-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
----------------------------------------------------------------------------------------------------