![](/img/trans.png)
[英]How to open "vscode" and "zsh in vscode" using terminal?(already install shell code command in path in VsCode)
[英]How to open a specific file using an env variable path with a command in VSCode?
我正在嘗試模仿我在 Sublime Text 中的命令:它會使用以下代碼段從命令面板打開特定文件:
{
"caption": "My Library",
"command": "open_file_env",
"args":
{
"platform": "Windows",
"file": "$LIBSFOLDER/my_library.jsx"
},
},
— 所以這會將$LIBSFOLDER
解析為路徑並打開my_library.jsx
文件。
我試圖弄清楚如何在 VSC 中做同樣的事情,但運氣不佳。 Ctrl+P
不起作用,因為它是基於工作區的,我想要一個全局快捷方式。
我嘗試通過以下命令使用multiCommand
和command-runner
擴展:
{
"command": "multiCommand.openLibrary",
"label": "My Library",
"sequence": [
{
"command": "command-runner.run",
"args": {
"command": "start \"C:/path_to_vscode/Code.exe\" \"D:/path_to_libraries/layers.jsx\""
}
},
]
}
這適用於三個問題:
那么,使用環境變量作為文件夾打開任何操作系統上不在工作區中的特定文件的最佳方法是什么?
也許我應該考慮一種不同的方法:也許可以將文件添加到“全局工作區”之類的東西,以便它們可以在Ctrl+P
中使用?
您可以使用擴展HTML 相關鏈接v0.13.0
您可以使用命令htmlRelatedLinks.openFile
{
"key": "ctrl+i m", // or any other combo
"command": "htmlRelatedLinks.openFile",
"args": {
"file": "${env:LIBSFOLDER}/my_library.jsx",
"method": "vscode.open",
"viewColumn": "split"
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.