]> apps.delaporte.us Git - dotfiles.git/commitdiff
Add neovim journal config
authorEdward Delaporte <delaport@illinois.edu>
Mon, 10 Feb 2025 21:20:49 +0000 (15:20 -0600)
committerEdward Delaporte <delaport@illinois.edu>
Mon, 10 Feb 2025 21:20:49 +0000 (15:20 -0600)
files/Microsoft.PowerShell_profile.ps1
files/neovim/nvjournal.lua [new file with mode: 0644]

index 76dfcf51d0b7c6b076d421e3d334767d3fb18f32..ae447feeef08bbd7ff9c55090baeaa35160d0d97 100644 (file)
@@ -51,6 +51,7 @@ $maybe_mods | ForEach-Object {
        }
 }
 
        }
 }
 
+$env:nvim_config = "$HOME\AppData\Local\nvim"
 
 # Load local source modules
 # Import-Module $env:src\powershell-scripts\modules\MarkdownGitHub.psm1
 
 # Load local source modules
 # Import-Module $env:src\powershell-scripts\modules\MarkdownGitHub.psm1
diff --git a/files/neovim/nvjournal.lua b/files/neovim/nvjournal.lua
new file mode 100644 (file)
index 0000000..6107aef
--- /dev/null
@@ -0,0 +1,20 @@
+local function new_note()
+  local month = os.date("%m")
+  local input = vim.fn.input("Topic: ")
+  local linput = string.lower(input)
+  local cleaned_input = string.gsub(linput, " ", "-")
+  local filename = "~/Box/Journal/" .. month .. "-" .. cleaned_input .. ".md"
+  if #linput == 0 then
+    filename = "~/Box/Journal/"
+  end
+  vim.cmd("edit " .. filename)
+end
+
+local function setup()
+  vim.api.nvim_create_user_command("Note", new_note, {})
+end
+
+return {
+  setup = setup,
+  new_note = new_note,
+}