From f718ce485fb13e71f0153eef53da0661d6b01e1c Mon Sep 17 00:00:00 2001 From: Ian Langworth Date: Sat, 9 Mar 2024 20:53:47 -0800 Subject: [PATCH] Use EDITOR=code within VS Code --- .zshrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.zshrc b/.zshrc index ec50cedf..915f1aee 100644 --- a/.zshrc +++ b/.zshrc @@ -34,7 +34,9 @@ if _has less; then export LESS='-Ri' fi -if _has vim; then +if [ "$TERM_PROGRAM" = "vscode" ]; then + export EDITOR=code VISUAL=less +elif _has vim; then export EDITOR=vim VISUAL=vim elif _has vi; then export EDITOR=vi VISUAL=vi @@ -437,7 +439,7 @@ vix() { echo -e "#!/usr/bin/env bash\n\nset -eo pipefail\n" > "$1" fi chmod -v 0755 "$1" - vim -c 'normal Go' "$1" + $EDITOR "$1" } # Make a new command in ~/bin