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

Multi-vault support #46

Open
junyeong-huray opened this issue Jun 27, 2023 · 2 comments
Open

Multi-vault support #46

junyeong-huray opened this issue Jun 27, 2023 · 2 comments

Comments

@junyeong-huray
Copy link

Hello

Obsidian can open multiple vaults. But obsidian-mode can treat only one vault
that is specified by obsidian-specify-path in the init.el.

I can make use of obsidian-* functions for multiple vaults after I run M-x obsidian-specify-path manually.
But it would be convenient if it is done automatically. I mean that when I am editing some markdowns of vault A,
M-x obsidian-* are applied to vault A. And if I am editing some
markdowns of vault B, M-x obsidian-* are applied to vault B.

I'm not sure this is a feasible feature. But it would be great if I can opt in/out this feature as I want.

Thanks,

@licht1stein
Copy link
Owner

In fact it might be possible. Let me think about it.

@mastro35
Copy link
Collaborator

Perhaps this could be a possible workaround:

Add a .dir-locals.el file to the vaults main directories like this one:

((nil . ((eval . (obsidian-specify-path "c:/whereveryourvaultis")))))

This will execute the obsidian-specify-path automatically when you open a file in the vault.

However, to be sure that you can have two different buffers that belongs to two differents vaults opened at the same time, you should also need to reapply the local variables each time you switch to an already opened buffer.
This hook should just do the trick:

(add-hook 'buffer-list-update-hook 'hack-dir-local-variables-non-file-buffer)

Of course I'm just trying to find a work around, I know this is not the perfect solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants