Advertisement

mac iterm2 + zsh 通过命令行方式连接到 VS Code

阅读量:

最近刚刚更新的VS Code 1.19.2 为命令行调用部分增加了新的命令行参数“–status”

调用方法解析

复制代码
     code --status 
    
      
    

随后我产生了浓厚的兴趣。此前一直采用图形用户界面的方式操作VS Code,但受过去在Ubuntu和Windows系统使用经验的影响,内心仍渴望能够借助命令行方式来启动VS Code。

实际上,任何操作系统本身均无法直接通过命令行调用VS Code,唯有微软官方提供了可用于命令行调用的bash脚本实现这一功能。

官方的bash脚本编写如下,在mac下保存为名为‘code’的终端执行文件:

复制代码
    #!/usr/bin/env bash
    #
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License. See License.txt in the project root for license information.
    
    function realpath() { /usr/bin/python -c "import os,sys; print os.path.real

全部评论 (0)

还没有任何评论哟~