]> arthur.barton.de Git - ax-zsh.git/blob - core/10_terminal/10_terminal.zshrc
10_terminal: Set terminal title and working directory in one function
[ax-zsh.git] / core / 10_terminal / 10_terminal.zshrc
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # 10_terminal.zshrc: Initialize terminal settings
3
4 # Set terminal title
5
6 function axzsh_terminal_title_precmd {
7         if [[ $TERM_PROGRAM == Apple_Terminal ]]; then
8                 local url=$(echo "file://$HOSTNAME$PWD" | sed -e 's| |%20|g')
9                 printf '\e]7;%s\a' "$url"
10                 printf '\e]0;%s\a' "$LOGNAME@$SHORT_HOST"
11         else
12                 printf '\e]0;%s\a' "$LOGNAME@$SHORT_HOST:$PWD"
13         fi
14 }
15
16 precmd_functions+=(axzsh_terminal_title_precmd)
17
18 # Colors
19
20 autoload -U colors
21 colors
22
23 # Text effects (FX)
24
25 typeset -Ag fx
26 fx=(
27         reset           "\e[00m"
28         bold            "\e[01m"
29         no-bold         "\e[22m"
30         italic          "\e[03m"
31         no-italic       "\e[23m"
32         underline       "\e[04m"
33         no-underline    "\e[24m"
34         blink           "\e[05m"
35         no-blink        "\e[25m"
36         reverse         "\e[07m"
37         no-reverse      "\e[27m"
38 )