From 69ce5a05e2c85b173f8c4ae8959323be8a582419 Mon Sep 17 00:00:00 2001 From: Michal Hanus Date: Tue, 30 Dec 2025 17:13:17 +0100 Subject: ssh show machine --- .zshrc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to '.zshrc') diff --git a/.zshrc b/.zshrc index a89cc6d..64b6e01 100644 --- a/.zshrc +++ b/.zshrc @@ -5,7 +5,15 @@ autoload -U colors && colors export GIT_PS1_SHOWUPSTREAM="verbose" -PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}$%{$reset_color%}%b " +function sshi() { + if [[ -n $SSH_CLIENT || -n $SSH_TTY ]]; then + echo "%{$fg[cyan]%}@%m%f " + fi +} + +#PS1="%B%{$fg[yellow]%}%n %{$fg[blue]%}%~ %{$fg[green]%}$%{$reset_color%}%b " +PS1="%B%{$fg[yellow]%}%n$(sshi) %{$fg[blue]%}%~ %{$fg[green]%}v%{$reset_color%}%b " +#PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " # Luke Conf source /usr/lib/git-core/git-sh-prompt @@ -17,7 +25,6 @@ set_git_prompt() { autoload -Uz add-zsh-hook add-zsh-hook precmd set_git_prompt -#PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " # Luke Conf zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" @@ -54,14 +61,15 @@ bindkey -v '^?' backward-delete-char function zle-line-init zle-keymap-select { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then - PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}<%{$reset_color%}%b " + #PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}<%{$reset_color%}%b " + PS1="%B%{$fg[yellow]%}%n$(sshi) %{$fg[blue]%}%~ %{$fg[green]%}<%{$reset_color%}%b " elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || [[ $1 = 'beam' ]]; then - PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}>%{$reset_color%}%b " + PS1="%B%{$fg[yellow]%}%n$(sshi) %{$fg[blue]%}%~ %{$fg[green]%}>%{$reset_color%}%b " else - PS1="%B%{$fg[yellow]%}%n% %{$fg[blue]%}%~ %{$fg[green]%}v%{$reset_color%}%b " + PS1="%B%{$fg[yellow]%}%n$(sshi) %{$fg[blue]%}%~ %{$fg[green]%}v%{$reset_color%}%b " fi zle reset-prompt } -- cgit v1.2.3