Open files from VS Code with your own external applications or terminal editors.
Open With Soft adds one context menu entry, Open With Soft..., to the Explorer and editor context menus. You can then choose from the applications configured in openWithSoft.apps, such as Typora, Notepad, Vim, Neovim, or any command available on the VS Code host.
It is especially useful when you work in WSL or Remote-SSH and still want to open selected files with tools outside VS Code.
Features
- Open files from Explorer or the editor context menu.
- Use the default
Alt+Shift+Pshortcut to open the current editor file. - Configure multiple applications with file glob matching.
- Open GUI applications in external mode.
- Open terminal-based editors such as
vi,vim,nvim, andnanoin VS Code integrated terminals. - Convert WSL paths to Windows-accessible
\\wsl.localhost\...paths when needed. - Open Remote-SSH files through local temporary copies and ask before syncing changes back.
- Use variables such as
${file},${remoteFile},${fileBasename}, and${workspaceFolder}in custom arguments.
Quick Start
Install the extension, open VS Code settings as JSON, and add at least one application:
{
"openWithSoft.apps": [
{
"menu": "Open with Typora",
"exe": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Typora\\Typora.exe",
"match": ["*.md", "*.markdown", "README*"]
}
]
}
Then right-click a matching file and choose:
Open With Soft... -> Open with Typora
You can also press Alt+Shift+P while a matching file is open in the active editor.
Common Examples
Open Markdown with Windows Typora from WSL
When VS Code is connected to WSL, the extension can convert a Linux path such as:
/home/me/project/README.md
to a Windows-accessible path such as:
\\wsl.localhost\Ubuntu-24.04\home\me\project\README.md
Example:
{
"openWithSoft.apps": [
{
"menu": "Open with Typora",
"exe": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Typora\\Typora.exe",
"match": ["*.md", "*.markdown", "README*"]
}
]
}
Open Remote-SSH Files with Local Apps
Remote-SSH files do not have a local path that desktop applications can open directly. For external applications, Open With Soft creates a local temporary copy, opens that copy, watches it for changes, and asks whether to replace the remote file when the local copy is modified.
Example:
{
"openWithSoft.apps": [
{
"menu": "Open with Typora",
"exe": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Typora\\Typora.exe",
"match": ["*.md", "*.markdown"]
}
]
}
When the local temporary file is saved, the extension asks:
The file "README.md" has been modified. Replace the remote file on "ssh-remote+server:/home/me/project/README.md" with the local copy?
Choose Yes to sync once, Always Sync to keep syncing modified temporary copies during the current VS Code session, No to skip the current change, or Stop Watching to stop monitoring that temporary file.
Edit with Vim in a Terminal
Terminal editors need an interactive terminal. Set mode to terminal:
{
"openWithSoft.apps": [
{
"menu": "Edit with Vim",
"exe": "vim",
"match": ["*.md", "*.txt", "*.json", "*.ts"],
"mode": "terminal",
"terminalName": "vim $FileName"
}
]
}
When you right-click /home/me/project/README.md, the extension opens a VS Code integrated terminal and runs:
vim /home/me/project/README.md
By default, a new terminal is created for each run. This avoids sending a new command into an existing terminal that may already be running Vim or another TUI application.
If you explicitly want to reuse a terminal:
{
"openWithSoft.apps": [
{
"menu": "Edit with Vim",
"exe": "vim",
"match": "*.md",
"mode": "terminal",
"terminalName": "vim $FileName",
"reuseTerminal": true
}
]
}
Configuration
openWithSoft.apps
Defines the applications shown after Open With Soft....
{
"openWithSoft.apps": [
{
"menu": "Open with Notepad",
"exe": "notepad.exe",
"match": ["*.txt", "*.log"]
}
]
}
Application fields:
| Field | Type | Required | Description |
|---|---|---|---|
menu |
string | yes | Label shown in the quick pick menu. |
exe |
string | yes | Executable path or command name. |
match |
string or string[] | no | Glob pattern list. If omitted, the app matches all files. |
mode |
"external" or "terminal" |
no | Defaults toexternal. |
args |
string[] | no | Custom arguments. If omitted, the selected file path is passed automatically. |
cwd |
string | no | Working directory. Supports variables. |
terminalName |
string | no | Terminal tab name for terminal mode. Supports variables. |
reuseTerminal |
boolean | no | Reuse terminal with the same name. Defaults tofalse. |
Match Patterns
match uses glob patterns:
{
"match": ["*.md", "*.markdown", "README*", "docs/**/*.md"]
}
Common patterns:
| Pattern | Meaning |
|---|---|
*.md |
Match Markdown files by file name. |
*.{md,markdown} |
Match multiple extensions. |
README* |
MatchREADME, README.md, README.zh.md, and similar names. |
**/*.log |
Match.log files anywhere in the workspace. |
docs/**/*.md |
Match Markdown files underdocs. |
* |
Match all file names. |
Patterns without / match only the file name. Patterns with / match the workspace-relative path. Matching is case-insensitive.
Custom Arguments
If an application needs special arguments, configure args:
{
"openWithSoft.apps": [
{
"menu": "Open with Custom Editor",
"exe": "C:\\Tools\\Editor\\editor.exe",
"match": "*.md",
"args": ["--reuse-window", "${file}"]
}
]
}
Supported variables:
| Variable | Meaning |
|---|---|
${file} |
Host-accessible file path. For Remote-SSH external mode, this is the local temporary copy path. |
${localFile} |
Same as ${file}. |
${remoteFile} |
Original VS Code resource path. |
${fileBasename} |
File name only. |
$FileName |
Alias for ${fileBasename} in terminalName. |
${fileDirname} |
Directory of the default file argument. |
${workspaceFolder} |
Workspace folder path, when available. |
In external mode, the default file argument is ${file}.
In terminal mode, the default file argument is ${remoteFile} so CLI editors receive the path that exists inside the terminal environment.
Why There Is One Context Menu Entry
VS Code extensions published to the Marketplace cannot dynamically create new context menu entries from user settings. Menu entries must be declared statically in the extension manifest.
For that reason, this extension uses one stable context menu entry:
Open With Soft...
The configured applications are shown in the quick pick menu after that.
Troubleshooting
The Context Menu Does Not Appear
- Right-click an actual file in the Explorer or editor.
- Try Command Palette ->
Open With Soft.... - Make sure
openWithSoft.appscontains at least one configured application. - Make sure the selected file matches the app's
matchpattern.
Typora or Another Windows App Cannot Open a WSL File
- Confirm the file path exists under
\\wsl.localhost\<DistroName>\.... - Confirm the Windows application can open that UNC path directly.
- If the app does not support UNC paths, use Remote-SSH temporary-copy behavior or a local synced folder instead.
Remote-SSH Changes Are Not Synced
- External applications edit a local temporary copy first.
- Save the file in the external application.
- Choose
Yeswhen the extension asks whether to replace the remote file. - If you chose
Stop Watching, runOpen With Soft...again to create a new watched temporary copy.
Vim Opens in the Wrong Environment
Use mode: "terminal". Terminal mode sends ${remoteFile} by default, which is the path visible inside the terminal environment.
Author
yacper [email protected]
License
MIT