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

Add line-navigation to :ObsidianOpen (AdvancedURI) #56

Merged
merged 3 commits into from
Nov 25, 2022

Conversation

gplusplus314
Copy link
Contributor

This PR adds a thin integration with the Obsidian Advanced URI plugin, allowing :ObsidianOpen to automatically scroll the Obsidian editor to the same line as NeoVim's.

See: Obsidian Advanced URI

Note: scrolling in the Reading viewmode does not currently work (see this issue). The Obsidian editor will scroll correctly when it's in edit-mode.

@gplusplus314
Copy link
Contributor Author

I'm very unsure about the way I propagated the .setup({...}) config/opts over to the command module. Could use a second opinion on that, for sure.

Comment on lines 9 to 18
local opts = {
use_advanced_uri = nil,
}

--- Inject init/setup dependencies here (internal use)
---
---@param use_advanced_uri boolean|?
command.setup = function(use_advanced_uri)
opts.use_advanced_uri = use_advanced_uri
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need all this because you can just access client.opts.use_advanced_uri directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a feeling I was doing something not quite right. Give me a sec.

This PR adds a thin integration with the Obsidian Advanced URI plugin,
allowing :ObsidianOpen to automatically scroll the Obsidian editor to
the same line as NeoVim's.

See: [Obsidian Advanced URI](https://github.com/Vinzent03/obsidian-advanced-uri)
@@ -97,16 +97,24 @@ command.open = function(client, data)

local encoded_vault = util.urlencode(vault_name)
local encoded_path = util.urlencode(tostring(path))

local uri
if client.opts.use_advanced_uri then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we go. Thanks for pointing it out.

Copy link
Owner

@epwalsh epwalsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for this

CHANGELOG.md Outdated Show resolved Hide resolved
@epwalsh epwalsh merged commit 36ab0d1 into epwalsh:main Nov 25, 2022
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.

2 participants