Opencode Vscode
# VS Code Install OpenCode
If you don't like using OpenCode's command line model, we can install OpenCode in the VS Code editor.
Open VS Code, enter the Extensions Marketplace, search for **OpenCode** and install:
!(#)
After installation is complete, click the OpenCode icon in the upper right corner to enter the OpenCode page:
!(#)
The entire interface is shown below:
!(#)
* * *
## Other Notes
OpenCode can not only run independently in the terminal, but also integrate with common development tools, such as VS Code, Cursor, Windsurf, VSCodium, etc.
**As long as your IDE supports the terminal, you can use OpenCode.**
The simplest way is: run `opencode` in the IDE's built-in terminal.
### 1. Quick Start
#### 1. Launch OpenCode
After opening a project in VS Code:
* Open the terminal (shortcut: Ctrl + `)
* Enter the following command:
opencode
This will enter the OpenCode interface.
!(#)
#### 2. Quick Launch Methods (Recommended)
| Function | Mac | Windows / Linux |
| --- | --- | --- |
| Quick Open OpenCode | Cmd + Esc | Ctrl + Esc |
| New OpenCode Session | Cmd + Shift + Esc | Ctrl + Shift + Esc |
**Notes:**
* If a session already exists, the shortcut will automatically focus it
* You can also click the OpenCode button in the IDE
### 2. Core Features
#### 1. Context Awareness (Very Important)
OpenCode will automatically obtain your current development context, for example:
* Currently open files
* Selected code
* Current tab
This means:
* No need to manually copy code
* AI can directly understand what you are editing
#### 2. File Reference Shortcuts
You can quickly insert file references using shortcuts:
| System | Shortcut |
| --- | --- |
| Mac | Cmd + Option + K |
| Windows / Linux | Ctrl + Alt + K |
The inserted effect is similar to:
@File#L37-42
This indicates referencing a specific line range of a file.
### 3. Configure Default Editor
If you want to use VS Code when executing `/editor` or `/export` in OpenCode, you need to set the environment variable:
export EDITOR="code --wait"
**Notes:**
* `--wait` means wait for editing to complete before returning
* Applicable to macOS / Linux
YouTip