GithubHelp home page GithubHelp logo

ptim / obsidian-open-vscode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nomarcub/obsidian-open-vscode

0.0 0.0 0.0 76 KB

Open vault in VSCode button for Obsidian.md

License: MIT License

TypeScript 81.38% JavaScript 18.62%

obsidian-open-vscode's Introduction

Open in VSCode

This plugin for Obsidian makes a ribbon button and a command to open your vault as a Visual Studio Code workspace.

It's functionality is probably made redundant now using the Shell commands and Customizable Sidebar (or Buttons) plugins, but it'll be maintained for the foreseeable future.

You can use VSCode for various purposes with your vault, such as for git version control, markdown formatting with Prettier, linting with markdownlint, mass formatting files and more.

video showcase

The icons work with light and dark mode.

light and dark

You can also use it as a command and assign hotkeys to it. You can disable the ribbon button in settings. command

Settings

Open VSCode by executing the code command

By default the plugin uses child_process to launch VSCode with the code command, but the previous method using URLs can still be enabled by checking the following option:

Open VSCode using a vscode:// URL instead of executing the code command.

On some systems, this may be faster than using the child_process approach.

Template for executing the code command

You can template the command opening VSCode however you like with its provided command line arguments. This way you can technically launch any command you set, so take caution. Potential use cases include opening workspaces with .code-workspace files (e.g. for Dendron), opening specific files, folders, etc.

Note that on MacOS, a full path to the VSCode executable is required (generally "/usr/local/bin/code").

You can use the following variables: {{vaultpath}} (absolute), {{filepath}} (relative). The default template is code "{{vaultpath}}" "{{vaultpath}}/{{filepath}}", which opens the current file (if there is one) in the workspace that is the vault's root folder. This gets expanded to be executed in your shell as code "C:\Users\YourUser\Documents\vault" "C:\Users\YourUser\Documents\vault/Note.md", for example.

Path to VSCode Workspace

If "Use URL" is checked, VSCode will open Obsidian files in this workspace (requires an absolute path).

Open file

If "Use URL" is checked, open the current file rather than the root of the Obsidian vault.

Installation

You can install the plugin via the Community Plugins tab within Obsidian. You can also manually copy from releases to your .obsidian/plugins/open-vscode folder.

Caveats

The first time you use the URL method for opening, VSCode displays a confirmation dialog (that you just can hit enter on) for security reasons. See this issue for more infomation.

Development

Run npm install for dependencies and npm run build to build.

This plugin follows the structure of the Obsidian Sample Plugin, see further details there. Contributions are welcome.

Credits

Toggle ribbon setting by @ozntel.

Thank you to the makers of the DEVONlink plugin, as it was a great starting point for working with ribbon icons in Obsidian. The icon is from icon-icons.com and was resized with iLoveIMG.

Support

If you like this plugin you can support me on PayPal here: Paypal

obsidian-open-vscode's People

Contributors

nomarcub avatar ozntel avatar ptim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.