Skip to content

Instantly share code, notes, and snippets.

@fortyplusdev
Forked from idleberg/vscode-macos-context-menu.md
Last active August 1, 2023 05:18
Show Gist options
  • Save fortyplusdev/a736211f5f48980cba6fd4139942d13f to your computer and use it in GitHub Desktop.
Save fortyplusdev/a736211f5f48980cba6fd4139942d13f to your computer and use it in GitHub Desktop.

Revisions

  1. fortyplusdev renamed this gist Aug 1, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @idleberg idleberg revised this gist Jul 30, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-macos-context-menu.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    - Select Quick Action
    - Set “Service receives selected” to `files or folders` in `any application`
    - Add a `Run Shell Script` action
    - your default shell should alreadybe selected, otherwise use `/bin/zsh` for macOS 10.15 (”Catalina”) or later
    - your default shell should already be selected, otherwise use `/bin/zsh` for macOS 10.15 (”Catalina”) or later
    - older versions of macOS use `/bin/bash`
    - if you're using something else, you probably know what to do :wink:
    - Set the script action to the following
  3. @idleberg idleberg revised this gist Jul 3, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-macos-context-menu.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@
    - Add a `Run Shell Script` action
    - your default shell should alreadybe selected, otherwise use `/bin/zsh` for macOS 10.15 (”Catalina”) or later
    - older versions of macOS use `/bin/bash`
    - if you're using something else, you probably know what to do
    - if you're using something else, you probably know what to do :wink:
    - Set the script action to the following
    ```
    for f in "$@"; do
  4. @idleberg idleberg revised this gist Jul 3, 2022. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion vscode-macos-context-menu.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,13 @@
    # Open in Visual Studio Code

    - Open Automator
    - Quick Action
    - Create a new document
    - Select Quick Action
    - Set “Service receives selected” to `files or folders` in `any application`
    - Add a `Run Shell Script` action
    - your default shell should alreadybe selected, otherwise use `/bin/zsh` for macOS 10.15 (”Catalina”) or later
    - older versions of macOS use `/bin/bash`
    - if you're using something else, you probably know what to do
    - Set the script action to the following
    ```
    for f in "$@"; do
  5. @idleberg idleberg revised this gist Jul 7, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vscode-macos-context-menu.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    - Quick Action
    - Set “Service receives selected” to `files or folders` in `any application`
    - Add a `Run Shell Script` action
    - Set the script action to
    - Set the script action to the following
    ```
    for f in "$@"; do
    open -a 'Visual Studio Code' "$@"
  6. @idleberg idleberg created this gist Jul 7, 2021.
    38 changes: 38 additions & 0 deletions vscode-macos-context-menu.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    # Open in Visual Studio Code

    - Open Automator
    - Quick Action
    - Set “Service receives selected” to `files or folders` in `any application`
    - Add a `Run Shell Script` action
    - Set the script action to
    ```
    for f in "$@"; do
    open -a 'Visual Studio Code' "$@"
    done
    ```

    - Set “Pass input” to `as arguments`
    - Save as `Open in Visual Studio Code`

    # Keyboard Shortcuts

    You can assign a global shortcut to run the services we just created

    - Open “System Preferences”
    - Select “Keyboard” then the “Shortcuts” tab
    - In the left pane, click on “Services”
    - In the right pane, scroll to “Files and Folders”
    - Select “Open in Visual Studio Code” click “add shortcut”
    - Select a shortcut

    # Edit Context Menu items

    You might want to rename or edit the items we just created

    - Activate Finder
    - Click on “Finder” in the Apple menu, select “Services” then “Services Preferences”
    - In the right pane, scroll to “Files and Folders” and scroll to the item you want to edit
    - Right click the item and select “Open in Visual Studio Code”
    - Edit and save

    Alternatively, you can edit the workflow (e.g. `~/Library/Services/Open in Visual Studio Code.workflow`) in your preferred text editor