Only show host when using ssh

This commit is contained in:
Cameron Reed 2024-08-06 08:13:18 -06:00
parent c4586d4026
commit b5ca587067
4 changed files with 33 additions and 3 deletions

View File

@ -32,11 +32,16 @@ alias nvc='nvim -c "edit \$MYVIMRC"'
alias c='clear'
alias e='echo'
alias pf='printf'
alias nf='neofetch'
alias ff='fastfetch'
alias :w='printf "Saved\n"'
alias :q='exit'
alias :wq='exit'
if command -v zigup &> /dev/null; then
alias zigup='zigup --install-dir "$HOME/.local/share/zigup" --path-link "$HOME/.local/bin/zig-local"'
fi
bindkey -s '^o' 'lfcd\n'
bindkey -s '^n' 'nvd\n'

View File

@ -4,7 +4,6 @@
[[ -f ~/.profile ]] && . ~/.profile
[[ -f $ZDOTDIR/.zshrc ]] && . $ZDOTDIR/.zshrc
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then

12
.zshenv
View File

@ -9,6 +9,10 @@ if [ -d /opt/devkitpro ]; then
export DEVKITPPC=$DEVKITPRO/devkitPPC
fi
if [ -d $HOME/.local/share/esp ]; then
export IDF_TOOLS_PATH=$HOME/.local/share/esp/idf
fi
# Copied from arch linux's default /etc/profile
@ -25,6 +29,14 @@ function append_path() {
append_path "/home/cameron/.local/share/JetBrains/Toolbox/scripts"
if [ -d "$HOME/.local/bin" ]; then
append_path "$HOME/.local/bin"
fi
if [ -d "$HOME/go/bin" ]; then
append_path "$HOME/go/bin"
fi
export PATH
unset -f append_path

16
.zshrc
View File

@ -96,8 +96,15 @@ function set_prompt() {
for i in $(seq 1 "${#prefixes[@]}"); do
prefix+="%F{${colors[$i]:-255}}${prefixes[$i]}%F{255} "
done
local user="${USER_OVERRIDE:-%n}"
local host="@${HOST_OVERRIDE:-%m}"
if [ -z "${SSH_CONNECTION}" ]; then
host=""
fi
PROMPT="[${prefix}%n@%m %1~]%(#.#.$) "
PROMPT="[${prefix}${user}${host} %1~]%(#.#.$) "
}
typeset -a precmd_functions
@ -134,6 +141,11 @@ function rmbookmark() {
fi
}
function get_idf() {
. $HOME/.local/share/esp/esp-idf/export.sh
alias idf="idf.py"
}
# Initialize direnv if it exists
@ -141,6 +153,8 @@ if command -v direnv &> /dev/null; then
eval "$(direnv hook zsh)"
fi
fastfetch
# Unset extra variables
unset CACHE_DIR