summaryrefslogtreecommitdiff
path: root/.config/zsh/.zshrc
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-19 22:01:44 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-19 22:01:44 -0700
commitf2159c3b3f60652d13a50700b3719fde242cad92 (patch)
tree4f9dec118956bc2fe29996d1b63d1d6aa42aba7c /.config/zsh/.zshrc
parent2587f3f30c1757fc6609b9ab9294e12700c195b6 (diff)
Add title support to zsh
Diffstat (limited to '.config/zsh/.zshrc')
-rw-r--r--.config/zsh/.zshrc17
1 files changed, 16 insertions, 1 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index a88765c..c6b6996 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -2,7 +2,7 @@
# PS1 colors and style.
autoload -U colors && colors
-PS1="%{$fg_bold[red]%}[%{$fg_bold[yellow]%}%n%{$fg_bold[green]%}@%{$fg_bold[blue]%}%M %{$fg_bold[magenta]%}%(5~|%-2~/.../%2~|%~)%{$fg_bold[red]%}]%{$fg_bold[cyan]%}$%{$reset_color%} "
+PS1="%{$fg_bold[red]%}[%{$fg_bold[yellow]%}%n%{$fg_bold[green]%}@%{$fg_bold[blue]%}%M %{$fg_bold[magenta]%}%(5~|%-2~/.../%2~|%~)%{$fg_bold[red]%}]%{$fg_bold[cyan]%}%#%{$reset_color%} "
# Set LS_COLORS via dircolors.
[[ -f $HOME/.config/dircolors ]] && eval "$(dircolors $HOME/.config/dircolors)"
@@ -25,5 +25,20 @@ compinit
# Include hidden files in autocomplete.
_comp_options+=(globdots)
+# Dynamic window title for zsh.
+case "$TERM" in (rxvt|rxvt-*|st|st-*|*xterm*|(dt|k|E)term|alacritty)
+ local term_title () { print -n "\e]0;${(j: :q)@}\a" }
+ precmd () {
+ local DIR="$(print -P '[%c]%#')"
+ term_title "$DIR" "zsh"
+ }
+ preexec () {
+ local DIR="$(print -P '[%c]%#')"
+ local CMD="${(j:\n:)${(f)1}}"
+ term_title "$DIR" "$CMD"
+ }
+ ;;
+esac
+
# Add syntax highlighting.
. /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh