Skip to content

Commit 956efb2

Browse files
committed
Better Cursor IDE detection
1 parent 040e7fb commit 956efb2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.zshrc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,22 @@ _versionof() {
2727
fi
2828
}
2929

30+
_inside_ai_coding_tool() {
31+
# Seems to detect Cursor inline terminals as of July 2025
32+
[[ -n "$COMPOSER_NO_INTERACTION" ]]
33+
}
34+
3035
# ENVIRONMENT VARIABLES {{{1
3136

3237
if _has less; then
3338
export PAGER=less
3439
export LESS='-Ri'
3540
fi
3641

37-
if [ "$TERM_PROGRAM" = "vscode" ]; then
38-
export EDITOR=code VISUAL=less
39-
# Cursor agents get hung up with git commands sometimes
42+
if _inside_ai_coding_tool ; then
4043
export GIT_PAGER=cat
44+
elif [ "$TERM_PROGRAM" = "vscode" ]; then
45+
export EDITOR=code VISUAL=less
4146
elif _has vim; then
4247
export EDITOR=vim VISUAL=vim
4348
elif _has vi; then
@@ -855,8 +860,7 @@ simpleprompt() {
855860
PS1="$ "
856861
}
857862

858-
if [ "$TERM_PROGRAM" = "vscode" ]; then
859-
# Use simple prompt for Cursor & LLMs
863+
if _inside_ai_coding_tool ; then
860864
simpleprompt
861865
elif [ -n "$SUDO_USER" ]; then
862866
colorprompt '33;1'

0 commit comments

Comments
 (0)