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

Configure ObsidianOpen to look into a specific folder

Open voidkrc opened this issue 1 year ago • 8 comments

🚀 The feature, motivation and pitch

Currently using NIX to manage my system app and home-manager creates an app inside /Applications/ in mac os. Configuring the ObsidianOpen to point to a path specified in the config would be optimal.

Example below: 스크린샷 2024-01-05 19 34 31

Alternatives

No response

Additional context

No response

voidkrc avatar Jan 05 '24 19:01 voidkrc

Configuring the ObsidianOpen to point to a path specified in the config would be optimal.

Are you talking about the path to the Obsidian.app file?

epwalsh avatar Jan 05 '24 19:01 epwalsh

Configuring the ObsidianOpen to point to a path specified in the config would be optimal.

Are you talking about the path to the Obsidian.app file?

Indeed

voidkrc avatar Jan 05 '24 20:01 voidkrc

Gotcha. That should be easy. Actually, where exactly is your Obsidian.app located? Is it just in a subdirectory of /Applications/? If so, we could try to automatically find it.

epwalsh avatar Jan 05 '24 20:01 epwalsh

Gotcha. That should be easy. Actually, where exactly is your Obsidian.app located? Is it just in a subdirectory of /Applications/? If so, we could try to automatically find it.

Not really, nix creates a symlink in here /etc/profiles/per-user/tommy/bin/, but the original file is in nix-store (the foilder is a massive hash)

voidkrc avatar Jan 05 '24 20:01 voidkrc

Ok got it. Well it was easiest to just add another option for this. #305

Can you confirm that works for you before I merge?

epwalsh avatar Jan 05 '24 20:01 epwalsh

🤔 so ObsidianOpen just opens the specified file in the Obsidian app? Was thinking it will just open the file in a new buffer within Neovim. Anyway to make it open within Neovim and not the Obsidian app?

rileyhawk1417 avatar Jan 18 '24 16:01 rileyhawk1417

Hi, I believe the PR #305 might have been closed in error. From reading the discussion chain, I believe the reporter may have had a separate issue, as I can replicate the command without the error:

❯ which obsidian
/etc/profiles/per-user/erichdblume/bin/obsidian

❯ cat $(which obsidian)
#! /nix/store/s30jrpgav677fpc9yvkqsib70xfmx7xi-bash-5.2p26/bin/bash -e
exec "/nix/store/qwgqkzh61cznjw6ghlbh91f6ra5nwigm-obsidian-1.6.3/Applications/Obsidian.app/Contents/MacOS/Obsidian"  "$@" 

❯ open -a /nix/store/qwgqkzh61cznjw6ghlbh91f6ra5nwigm-obsidian-1.6.3/Applications/Obsidian.app --background "obsidian://open?vault=zk"

❯ obsidian --background obsidian://open?vault=zk

The last two commands are at least functionally equivalent in that they both open Obsidian to a basic default page in the appropriate vault/workspace. This is with nix-pkgs' Obsidian.nvim, at least as of nixos-24.05.

Is there any way to revive and retest that PR? I am happy to test it although I am still learning Nix and will need to figure out how to bundle up Obsidian.nvim outside of nixpkgs in order to build it.

eblume avatar Aug 05 '24 22:08 eblume

Also @rileyhawk1417 I think you want :ObsidianFollowLink, which works for me despite the above issue I mentioned.

eblume avatar Aug 07 '24 23:08 eblume