Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add lsp workspace commands to open daily notes #85

Merged
merged 7 commits into from
May 20, 2024

Conversation

Kxnr
Copy link
Contributor

@Kxnr Kxnr commented May 14, 2024

close #99

@Feel-ix-343
Copy link
Owner

Thank you!

@Feel-ix-343
Copy link
Owner

this is developing nicely!

@Feel-ix-343
Copy link
Owner

running lua vim.lsp.buf.execute_command({command="jump", arguments={"today"}}) will make it work;

there is also

  • lua vim.lsp.buf.execute_command({command="jump", arguments={"yesterday"}})
  • lua vim.lsp.buf.execute_command({command="jump", arguments={"3 days ago"}})

that fuzzydate lib is really special

@Feel-ix-343
Copy link
Owner

Feel-ix-343 commented May 19, 2024

Right now we can do

      require("lspconfig").markdown_oxide.setup({
        -- ...
        capabilities = capabilities,
        on_attach = on_attach,
        commands = {
          Today = {
             function()
               vim.lsp.buf.execute_command({command="jump", arguments={"today"}})
             end,
             description = "Open today's daily note"
          },
          Tomorrow = {
             function()
               vim.lsp.buf.execute_command({command="jump", arguments={"tomorrow"}})
             end,
             description = "Open tomorrow's daily note"
          },
          Yesterday = {
             function()
               vim.lsp.buf.execute_command({command="jump", arguments={"yesterday"}})
             end,
             description = "Open yesterday's daily note"
          },
        }
      })

but cannot provide a default command for entering the jump arguments.

A dedicated plugin would be so helpful for this; right now, the user will have to modify their on_attach to enable this (which we can provide snippets for). Either we make our own, or continue the developments in #65 (or both?). This would be helpful for the other non-ideal nvim-cmp and capabilities configuration.

I think "both" is the way to go: #95

@Feel-ix-343
Copy link
Owner

With this snippet, users can open daily notes with natural language Daily two days ago

  if client.name == "markdown_oxide" then

    vim.api.nvim_create_user_command(
      "Daily",
      function(args)
        local input = args.args

        vim.lsp.buf.execute_command({command="jump", arguments={input}})

      end,
      {desc = 'Open daily note', nargs = "*"}
    )
  end

@Feel-ix-343 Feel-ix-343 marked this pull request as ready for review May 19, 2024 23:27
@Feel-ix-343
Copy link
Owner

Let me know what you think and we'll merge right in

@Feel-ix-343 Feel-ix-343 merged commit 418c50b into Feel-ix-343:main May 20, 2024
1 check passed
@Feel-ix-343
Copy link
Owner

I wanted to get it closed 😄

We can talk more on the main issue

src/commands.rs Show resolved Hide resolved
@Kxnr Kxnr mentioned this pull request May 20, 2024
4 tasks
Feel-ix-343 added a commit that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide LSP commands to navigate daily notes
3 participants