NixOS + home-manager configs, mirrored from GitLab SaaS. gitlab.com/andreijiroh-dev/nixops-config
nix-flake nixos home-manager nixpkgs nix-flakes
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(bash/lib): improve VS Code Remote Tunnels/SSH detection

Currently, it works by getting the VSCODE_GIT_ASKPASS_NODE variable first
as an argument for dirname for the parent directory, and the appending that
output to point to the remote CLI binary. I might improve this further by
not relying on the default /home/<username> path and utilize the HOME
variable.

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>

+14 -2
+14 -2
misc/bash/lib/detect-vscode-for-git
··· 3 3 # Sets EDITOR and related variables to use VS Code instead of firing up nano (or worse vi), 4 4 # based on env var detection of VSCODE_* vars. 5 5 6 - if [[ -n $VSCODE_IPC_HOOK_CLI && -n $VSCODE_GIT_IPC_HANDLE ]]; then 7 - export GIT_EDITOR="code --wait" EDITOR="code --wait" VISUAL="code --wait" 6 + if [[ -n $VSCODE_IPC_HOOK_CLI && -n $VSCODE_GIT_ASKPASS_NODE ]]; then 7 + __VSCODE_BASE_PATH="$(dirname "${VSCODE_GIT_ASKPASS_NODE}")" 8 + 9 + # Check if the path is in ~/.vscode/cli/servers (for Remote Tunnels), ~/.vscode-server/cli 10 + # (for Remote SSH) or not 11 + if [[ $__VSCODE_BASE_PATH =~ ^/home/[^/]+/.vscode/cli/servers ]] || [[ $__VSCODE_BASE_PATH =~ ^/home/[^/]+/.vscode-server/cli ]]; then 12 + # If it is, set the path to the correct location 13 + VSCODE_CLI_PATH="${__VSCODE_BASE_PATH}/bin/remote-cli/code" 14 + else 15 + # otherwise just use plain cli 16 + VSCODE_CLI_PATH="$(command -v code)" 17 + fi 18 + 19 + export GIT_EDITOR="${VSCODE_CLI_PATH} --wait" EDITOR="${VSCODE_CLI_PATH} --wait" VISUAL="${VSCODE_CLI_PATH} --wait" VSCODE_CLI_PATH 8 20 fi