diff options
| author | Dimitris Dimitropoulos <dimitris.dimitropoulos00@gmail.com> | 2025-08-11 21:35:44 +0300 |
|---|---|---|
| committer | Dimitris Dimitropoulos <dimitris.dimitropoulos00@gmail.com> | 2025-08-11 21:45:11 +0300 |
| commit | 8f594ac3f2aaec151e4d97187ac6592ec78addbf (patch) | |
| tree | bf57a0c1e974b8e88d166775a1bdd1730100f93b /lsp/markdown_oxide.lua | |
| parent | fix(elmls): update config to 0.11+ (diff) | |
| download | nvim-lspconfig-8f594ac3f2aaec151e4d97187ac6592ec78addbf.tar nvim-lspconfig-8f594ac3f2aaec151e4d97187ac6592ec78addbf.tar.gz nvim-lspconfig-8f594ac3f2aaec151e4d97187ac6592ec78addbf.tar.bz2 nvim-lspconfig-8f594ac3f2aaec151e4d97187ac6592ec78addbf.tar.lz nvim-lspconfig-8f594ac3f2aaec151e4d97187ac6592ec78addbf.tar.xz nvim-lspconfig-8f594ac3f2aaec151e4d97187ac6592ec78addbf.tar.zst nvim-lspconfig-8f594ac3f2aaec151e4d97187ac6592ec78addbf.zip | |
fix(markdown_oxide): update config to 0.11+
- Use drop buf.execute command and use :exec_cmd
Diffstat (limited to 'lsp/markdown_oxide.lua')
| -rw-r--r-- | lsp/markdown_oxide.lua | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lsp/markdown_oxide.lua b/lsp/markdown_oxide.lua index 8f2697bf..317bd433 100644 --- a/lsp/markdown_oxide.lua +++ b/lsp/markdown_oxide.lua @@ -8,25 +8,29 @@ --- Inspired by and compatible with Obsidian. --- --- Check the readme to see how to properly setup. + +---@param client vim.lsp.Client +---@param bufnr integer +---@param cmd string +local function command_factory(client, bufnr, cmd) + return client:exec_cmd({ + title = ('Markdown-Oxide-%s'):format(cmd), + command = 'jump', + arguments = { cmd }, + }, { bufnr = bufnr }) +end + return { root_markers = { '.git', '.obsidian', '.moxide.toml' }, filetypes = { 'markdown' }, cmd = { 'markdown-oxide' }, - on_attach = function(_, bufnr) - vim.api.nvim_buf_create_user_command(bufnr, 'LspToday', function() - vim.lsp.buf.execute_command { command = 'jump', arguments = { 'today' } } - end, { - desc = "Open today's daily note", - }) - vim.api.nvim_buf_create_user_command(bufnr, 'LspTomorrow', function() - vim.lsp.buf.execute_command { command = 'jump', arguments = { 'tomorrow' } } - end, { - desc = "Open tomorrow's daily note", - }) - vim.api.nvim_buf_create_user_command(bufnr, 'LspYesterday', function() - vim.lsp.buf.execute_command { command = 'jump', arguments = { 'yesterday' } } - end, { - desc = "Open yesterday's daily note", - }) + on_attach = function(client, bufnr) + for _, cmd in ipairs({ 'today', 'tomorrow', 'yesterday' }) do + vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. ('%s'):format(cmd:gsub('^%l', string.upper)), function() + command_factory(client, bufnr, cmd) + end, { + desc = ('Open %s daily note'):format(cmd), + }) + end end, } |
