]> us-delaporte.pagekite.me Git - dotfiles.git/blob - files/ts/neovim/lua/nvjournal.lua
C64 updates
[dotfiles.git] / files / ts / neovim / lua / nvjournal.lua
1 local function new_note()
2 local month = os.date("%m")
3 local input = vim.fn.input("Topic: ")
4 local linput = string.lower(input)
5 local cleaned_input = string.gsub(linput, " ", "-")
6 local filename = "~/Box/Journal/" .. month .. "-" .. cleaned_input .. ".md"
7 if #linput == 0 then
8 filename = "~/Box/Journal/"
9 end
10 vim.cmd("edit " .. filename)
11 end
12
13 local function setup()
14 vim.api.nvim_create_user_command("Note", new_note, {})
15 end
16
17 return {
18 setup = setup,
19 new_note = new_note,
20 }