yujinyuz / gitpad.nvim

minimal neovim plugin for taking down notes for git projects, branch, etc.
https://yujinyuz.github.io/gitpad.nvim/
MIT License
43 stars 4 forks source link

Can default_text have option to be a function? And then pass the filename as a parameter we can use? #9

Open GitMurf opened 1 month ago

GitMurf commented 1 month ago

This plugin is amazing... just what I needed!

One thing I find myself wanting is to create default_text dynamically via a function. Is this something you would consider? allowing to define as a function and then providing function parameters of the filename and also would be nice if could provide the type of gitpad (project, branch, daily note, or current file) so that we can do some conditional logic based on the type of gitpad. Thoughts?

yujinyuz commented 1 month ago

@GitMurf Thanks! Glad you liked this plugin

That sounds like a nice idea. Maybe we could just use the opts for similar to what we did for the title where you can just pass the title parameter when toggling notes

Maybe something like:

local date_filename = 'daily-' .. os.date('%Y-%m-%d.md')
require('gitpad').toggle_gitpad { filename = date_filename, on_attach = function() end, default_text = function() end, title = 'Daily Notes }