Implement hotkeys in Obsidian and VS Code
Open Obsidian’s current file in VS Code
- [p] opens current file, jumps to same line
- [p] uses vault root as workspace folder
- [p] works with spaces in filename
- requires Shell commands
- Uses vault’s root folder as workspace
Open VS Code’s current file in Obsidian’s main vault
- [p] opens current file, jump to same line
- [p] works with spaces in filename
- [p] opens from predefined vault or symbolic links workspace folder as
D:\Notes\external
- requires Terminal Command Keys and Advanced URI
- replace
D:/Notes/
which occurs 3 times with your vault path (use/
instead of\
) - first character
\u0001
clears drafted prompt in the terminal - if the file is in your main vault, open it
- otherwise update the
external/
symbolic link if necessary (requires admin privileges) - then opens the file in the main vault
Ignore the folder
external/
in git and in Remotely Save
Add VS Code keyboard shortcut:
Alternatives
Open VS Code file from main vault in Obsidian
- [p] opens current file, jump to same line
- [p] works with spaces in filename
- [c] file must be in the one predefined vault
- requires Terminal Command Keys and Advanced URI
- default integrated terminal must be PowerShell
- first character
\u0001
clears drafted prompt in the terminal - replace the vault name with yours
- vault must be specified because Terminal Command Keys’s
${file}
variable starts lowercase and therefore isn’t recognized by obsidian as a vault
Add VS Code keyboard shortcut:
Open VS Code file at the top from main vault in Obsidian
- requires Terminal Command Keys
- [p] opens current file
- [p] works with spaces in filename
- [c] file must be in the one predefined vault
Open terminal file in Obsidian
- [p] works with every markdown file
- [c] requires admin privileges for new vaults
- GitHub - Yetenol/Obsidian-CLI
Goal
- Open the current file in the other editor
- Use the same workplace folder / vault
Technical difficulties
- Obsidian settings and plugins are stored in the workplace folder
- Obsidian is not designed for multiple vaults
- Obsidian’s known vaults are stored in
$env:AppData\obsidian\obsidian.json
- Create a new obsidian vault
obsidian://new?vault=my%20vault&path=path%2Fto%2Fmy%20note
Sources:
Related:
Tags:
Obsidian
Visual Studio Code
Markdown - Write content-focused and format with hierarchy, abstract highlighting, and meta-information