summaryrefslogtreecommitdiffstatshomepage
path: root/bashrc
blob: c8ab133270b3c8bba2b4ede5be44084ec5abaf55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash

comp_dir=${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions

if [ -d "~/.bash" ]; then for f in ~/.bash/*; do source $f; done; fi
if [ -d "$comp_dir" ]; then for f in "$comp_dir"/*; do source $f; done; fi

command -v starship >/dev/null 2>&1 && eval "$(starship init bash)"

set_win_title() {
  local prefix

  if [ "$USER" != "tobyv" ]; then
    prefix="${USER} in "
  fi

  if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
    prefix="${prefix/in/on}${HOST} in "
  fi

  echo -ne "\033]0;${prefix}${PWD/$HOME/~}\007"
}

starship_precmd_user_func="set_win_title"