Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

neovim/lsp/markdown_oxide.lua

Raw
---@brief
---
--- [Markdown-Oxide](https://github.com/Feel-ix-343/markdown-oxide)
--- Editor Agnostic PKM for Obsidian-compatible daily notes.

---@type vim.lsp.Config
return {
	cmd = { 'markdown-oxide' },
	filetypes = { 'markdown' },
	root_markers = { '.obsidian', '.moxide.toml' },
	workspace_required = true,
	on_attach = function(client, bufnr)
		local user_command = require 'std.user_command'
		for _, cmd in ipairs({ 'today', 'tomorrow', 'yesterday' }) do
			local name = 'MO' .. ('%s'):format(cmd:gsub('^%l', string.upper))
			user_command.buffer(bufnr)[name] ('Open %s daily note'):format(cmd) (function()
				client:exec_cmd({
					title = ('Markdown-Oxide-%s'):format(cmd),
					command = 'jump',
					arguments = { cmd },
				}, { bufnr = bufnr })
			end)
		end
	end,
}