Something went wrong. Try again.
NixOS + home-manager configs, mirrored from GitLab SaaS. gitlab.com/andreijiroh-dev/nixops-config
nix-flake nixos home-manager nixpkgs nix-flakes
Something went wrong. Try again.
1.7 kB · 43 lines
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344#!/usr/bin/env bash# SPDX-License-Identifier: MPL-2.0# Sets EDITOR and related variables to use VS Code instead of firing up nano (or worse vi) on# your VS Code terminals, based on env var detection of VSCODE_* vars. Utilized by git-commit# and similar git commands that fire up an editor, among others.
# Handle verbose logginglog() { echo "[detect-vscode-for-git] $*"}
if [[ -n $DEBUG ]]; then set -xfi
if [[ "$VSCODE_GIT_IPC_HANDLE" != "" && "$VSCODE_GIT_ASKPASS_NODE" != "" && "$TERM_PROGRAM" == "vscode" ]]; then __VSCODE_BASE_PATH="$(dirname "${VSCODE_GIT_ASKPASS_NODE}")" log "Detected VS Code environment. Base path: ${__VSCODE_BASE_PATH}" # If it is, set the path to the correct location __VSCODE_STABLE_CLI_PATH="${__VSCODE_BASE_PATH}/bin/remote-cli/code" __VSCODE_STABLE_DESKTOP_PATH="${__VSCODE_BASE_PATH}/bin/code" __VSCODE_INSIDERS_CLI_PATH="${__VSCODE_BASE_PATH}/bin/remote-cli/code-insiders" __VSCODE_INSIDERS_DESKTOP_PATH="${__VSCODE_BASE_PATH}/bin/code-insiders"
# Check if the stable or insiders version exists if [[ -f "$__VSCODE_INSIDERS_CLI_PATH" ]]; then VSCODE_CLI_PATH="$__VSCODE_INSIDERS_CLI_PATH" elif [[ -f "$__VSCODE_STABLE_CLI_PATH" ]]; then VSCODE_CLI_PATH="$__VSCODE_STABLE_CLI_PATH" elif [[ -f "$__VSCODE_INSIDERS_DESKTOP_PATH" ]]; then VSCODE_CLI_PATH="$__VSCODE_INSIDERS_DESKTOP_PATH" elif [[ -f "$__VSCODE_STABLE_DESKTOP_PATH" ]]; then VSCODE_CLI_PATH="$__VSCODE_STABLE_DESKTOP_PATH" fi
log "Using VS Code CLI path: ${VSCODE_CLI_PATH}" export GIT_EDITOR="${VSCODE_CLI_PATH} --wait" EDITOR="${VSCODE_CLI_PATH} --wait" VISUAL="${VSCODE_CLI_PATH} --wait" VSCODE_CLI_PATHfi
if [[ -n $DEBUG ]]; then set +xfi