vscode 给我们提供了一个从命令行启动并打开vscode编辑器的shell脚本, 如 在vscode中打开当前文件夹,可以执行 code . 即可。
code命令安装方法:
打开vscode 使用 ctrl + shift + p 快捷键打开命令行窗口, 然后输入 shell command 然后在选择 Shell Command: Install 'code' command in PATH 即可在terminal 终端中安装code 命令。
vscode 启动命令脚本
#!/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.
# when run in remote terminal, use the remote cli
if [ -n "$VSCODE_IPC_HOOK_CLI" ]; then
REMOTE_CLI="$(which -a 'code' | grep /remote-cli/)"
if [ -n "$REMOTE_CLI" ]; then
"$REMOTE_CLI" "$@"
exit $?
fi
fi
function app_realpath() {
SOURCE=$1
while [ -h "$SOURCE" ]; do
DIR=$(dirname "$SOURCE")
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /