mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
Improve bash/zsh/terminal consistency
This commit is contained in:
parent
bb8b9420d6
commit
b780b2ce34
9 changed files with 160 additions and 50 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Tell the terminal about the working directory at each prompt.
|
||||
# Tell Apple Terminal about the working directory at each prompt.
|
||||
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
|
||||
update_terminal_cwd() {
|
||||
# Identify the directory using a "file:" scheme URL,
|
||||
|
|
@ -14,15 +14,22 @@ else
|
|||
fi
|
||||
|
||||
set_term_title() {
|
||||
if [[ -n "${SSH_CLIENT}" ]]; then
|
||||
local title="$USER@${HOSTNAME%%.*}:${PWD/#$HOME/\~}"
|
||||
else
|
||||
local title="${PWD/#$HOME/\~}"
|
||||
fi
|
||||
|
||||
update_terminal_cwd
|
||||
|
||||
case $TERM in
|
||||
xterm*|rxvt*|alacritty)
|
||||
local title="\033]2;$USER@${HOSTNAME%%.*}:${PWD/#$HOME/~}\a"
|
||||
;;
|
||||
*)
|
||||
local title=""
|
||||
;;
|
||||
screen*|xterm*|rxvt*|alacritty)
|
||||
printf "\e]2;%s\a" "${title}"
|
||||
;;
|
||||
*)
|
||||
: # NOOP
|
||||
;;
|
||||
esac
|
||||
printf "$title"
|
||||
}
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue