Skip to content

Commit b9da750

Browse files
committed
🌟 [feat] Dynamic EDITOR env
1 parent ed9014a commit b9da750

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

pkg/git/.gitconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ template = "~/.dotfiles/pkg/git/.git_commit_template"
6060
[core]
6161
attributesFile = "~/.dotfiles/pkg/git/.gitattributes"
6262
commentString = "//"
63+
# editor = "micro" # Just use $EDITOR
6364
excludesFile = "~/.dotfiles/pkg/git/.gitignore"
64-
editor = "nano"
6565

6666
[diff]
6767
# https://blog.gitbutler.com/how-git-core-devs-configure-git/#better-diff

zsh/.zshenv

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ export LANG="zh_TW.UTF-8" # Chinese (Taiwan)
1919
export LC_ALL="en_US.UTF-8" # English
2020

2121
# Editor
22-
export EDITOR="subl" # Sublime Text
23-
# export EDITOR="code" # VS Code
22+
if [[ -n "$IS_CURSOR" ]]; then # Cursor
23+
export EDITOR="cursor --wait"
24+
elif [[ "$TERM_PROGRAM" == "vscode" ]]; then # VS Code
25+
export EDITOR="code --wait"
26+
else
27+
export EDITOR="subl --wait" # Sublime Text
28+
fi
2429
# export EDITOR="micro" # micro
2530
# export EDITOR="nano" # nano
2631
# export EDITOR="vim" # vim

0 commit comments

Comments
 (0)