obsidian.nvim icon indicating copy to clipboard operation
obsidian.nvim copied to clipboard

More keybindings

Open aitvann opened this issue 1 year ago • 3 comments

🚀 The feature, motivation and pitch

first of all big thanks for a great plugin ! here are some features I really miss:

  • a variant of ObsidianNew command that would requests user's input to get new note name.
  • a variant of ObsidianLink command that would open up a picker to select a file or a header to link.
  • a variant of ObsidianRename command that would request user input to get a new name of the current note.

Alternatives

public lua functions similar to require("obsidian").util.toggle_checkbox() are also fine.

Additional context

I'am not a big fan of typing commands in NeoVim so I bind every command that I would ever use to a key but currently it seems to be impossible to do that with the commands I listed above (correct me if I'am wrong)

aitvann avatar Feb 02 '24 20:02 aitvann

Hey @aitvann, those features are on the roadmap, but it might be a while as I'm pretty busy right now. In the meantime you could use Telescope's API to open a picker, and then call the corresponding Obsidian.nvim command with the result.

Here's an example of using the Telescope API from our ObsidianLink command: https://github.com/epwalsh/obsidian.nvim/blob/afe4bce39d811f1c085d097edde6e33b33bae557/lua/obsidian/commands/link.lua#L78-L95

epwalsh avatar Feb 02 '24 21:02 epwalsh

By the way you can run any Obsidian.nvim command programmatically like this:

:lua require("obsidian").get_client():command("ObsidianNew", { args = "Foo" })

epwalsh avatar Feb 02 '24 21:02 epwalsh

thank you. feel free to close the issue

aitvann avatar Feb 03 '24 10:02 aitvann

By the way you can run any Obsidian.nvim command programmatically like this:

:lua require("obsidian").get_client():command("ObsidianNew", { args = "Foo" })

hi, may I ask how to run command "ObsidianTags" using in this form? When I run :lua require("obsidian").get_client():command("ObsidianTags", { args = "Foo" }) to filter notes with Foo tag, it just prompted that Error executing lua vim/shared.lua:0: Expected table, got nil.

swahpy avatar Apr 29 '24 07:04 swahpy