Mac 命令行打开VsCode

释放双眼,带上耳机,听听看~!

命令行

命令行命令安装
安装 VSCode Shell 命令,按 Shift+Cmd+P 搜索 shell command install 回车即可。

命令行帮助

Visual Studio Code 1.30.0

Usage: code [options] [paths...]

To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')

Options:
  -d, --diff <file> <file>           Compare two files with each other.
  -a, --add <dir>                    Add folder(s) to the last active window.
  -g, --goto <file:line[:character]> Open a file at the path on the specified line and character position.
  -n, --new-window                   Force to open a new window.
  -r, --reuse-window                 Force to open a file or folder in an already opened window.
  -w, --wait                         Wait for the files to be closed before returning.
  --locale <locale>                  The locale to use (e.g. en-US or zh-TW).
  --user-data-dir <dir>              Specifies the directory that user data is kept in. Can be used to open multiple distinct
                                     instances of Code.
  -v, --version                      Print version.
  -h, --help                         Print usage.

Extensions Management:
  --extensions-dir <dir>                                         Set the root path for extensions.
  --list-extensions                                              List the installed extensions.
  --show-versions                                                Show versions of installed extensions, when using
                                                                 --list-extension.
  --uninstall-extension (<extension-id> | <extension-vsix-path>) Uninstalls an extension.
  --install-extension (<extension-id> | <extension-vsix-path>)   Installs or updates the extension. Use `--force` argument to
                                                                 avoid prompts.
  --enable-proposed-api (<extension-id>)                         Enables proposed API features for extensions. Can receive
                                                                 one or more extension IDs to enable individually.

Troubleshooting:
  --verbose                          Print verbose output (implies --wait).
  --log <level>                      Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn',
                                     'info', 'debug', 'trace', 'off'.
  -s, --status                       Print process usage and diagnostics information.
  -p, --performance                  Start with the 'Developer: Startup Performance' command enabled.
  --prof-startup                     Run CPU profiler during startup
  --disable-extensions               Disable all installed extensions.
  --disable-extension <extension-id> Disable an extension.
  --inspect-extensions               Allow debugging and profiling of extensions. Check the developer tools for the
                                     connection URI.
  --inspect-brk-extensions           Allow debugging and profiling of extensions with the extension host being paused after
                                     start. Check the developer tools for the connection URI.
  --disable-gpu                      Disable GPU hardware acceleration.
  --upload-logs                      Uploads logs from current session to a secure endpoint.
  --max-memory                       Max memory size for a window (in Mbytes).

```常用命令

```// 在 VSCode 中打开当前目录
$ code .

// 在最近使用过的 VSCode 窗口打开当前目录
$ code -r .

// 创建新的窗口
$ code -n
$ code --new-window

// 更改语言
$ code --locale=es

// 跳转到指定文件的指定行列,相当于跳转到指定文件的指定行的从左到右第几个字符上
$ code -g /path/to/<file>:10:10
$ code --goto /path/to/<file>:10:20

// 打开 diff 编辑器比较文件
$ code -d <file1> <file2>
$ code --diff <file1> <file2>

// 查看帮助选项
$ code --help

// 禁用所有扩展
$ code --disable-extensions

给TA打赏
共{{data.count}}人
人已打赏
Mac技巧教程分享

Mac VSCode 基本操作

2020-2-24 0:36:06

教程分享

免费申请#Office365 E5 开发者订阅#3个月并附无限续期教程

2020-2-24 22:06:25

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索