`vim.g.vscode` で[[VSCode Neovim]]かの判定を行い、`vscode.action` コマンドで[[VSCode]]のコマンドを実行する。
```lua
if vim.g.vscode then
vim.keymap.set("n", "gru", function()
vscode.action("workbench.action.findInFiles")
end)
vim.keymap.set("n", "<space>w", function()
vscode.action("workbench.action.closeOtherEditors")
end)
end
```
`vscode.action` は非同期の[[VSCode]]コマンド実行関数であり、同期の `vscode.call` をはじめ[他にも多数の関数がある](https://github.com/vscode-neovim/vscode-neovim?tab=readme-ov-file#%EF%B8%8F-api)。