summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Santiago <[email protected]>2025-05-28 14:48:59 -0300
committerLeonardo Santiago <[email protected]>2025-05-28 14:48:59 -0300
commit7902cb15bc962b23d00a8f7d27d5bebc7d34f2ac (patch)
tree7af38d89527761a4e942fc30c878daa04ae10f4f
parentd9205ffd26f0d6cb6d9422cc0bafc01ebebdb3e2 (diff)
chore(tramp): add simple `$PS1` to handle `$TERM=dumb` case
otherwise emacs' tramp mode hangs forever
-rw-r--r--modules/basic.nix36
1 files changed, 20 insertions, 16 deletions
diff --git a/modules/basic.nix b/modules/basic.nix
index f6e8360..e78e606 100644
--- a/modules/basic.nix
+++ b/modules/basic.nix
@@ -43,22 +43,26 @@
completion.enable = true;
promptInit =
''
- PS1="\[\033[1;95m\][\h]\[\033[0m\] \[\033[0;32m\]\w\[\033[0m\] :: "
- vterm_printf() {
- if [ -n "$TMUX" ] && ([ "$${TERM%%-*}" = "tmux" ] || [ "$${TERM%%-*}" = "screen" ]); then
- # Tell tmux to pass the escape sequences through
- printf "\ePtmux;\e\e]%s\007\e\\" "$1"
- elif [ "$${TERM%%-*}" = "screen" ]; then
- # GNU screen (screen, screen-256color, screen-256color-bce)
- printf "\eP\e]%s\007\e\\" "$1"
- else
- printf "\e]%s\e\\" "$1"
- fi
- }
- vterm_prompt_end(){
- vterm_printf "51;A$(whoami)@$(hostname):$(pwd)"
- }
- PS1=$PS1'\[$(vterm_prompt_end)\]'
+ if [[ "$TERM" == "dumb" ]] then
+ export PS1="> "
+ else
+ PS1="\[\033[1;95m\][\h]\[\033[0m\] \[\033[0;32m\]\w\[\033[0m\] :: "
+ vterm_printf() {
+ if [ -n "$TMUX" ] && ([ "$${TERM%%-*}" = "tmux" ] || [ "$${TERM%%-*}" = "screen" ]); then
+ # Tell tmux to pass the escape sequences through
+ printf "\ePtmux;\e\e]%s\007\e\\" "$1"
+ elif [ "$${TERM%%-*}" = "screen" ]; then
+ # GNU screen (screen, screen-256color, screen-256color-bce)
+ printf "\eP\e]%s\007\e\\" "$1"
+ else
+ printf "\e]%s\e\\" "$1"
+ fi
+ }
+ vterm_prompt_end(){
+ vterm_printf "51;A$(whoami)@$(hostname):$(pwd)"
+ }
+ PS1=$PS1'\[$(vterm_prompt_end)\]'
+ fi
'';
};
programs.direnv = {