aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
blob: 8c69ed3e8098a918f43f9824ed57eab725b2b867 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# shellcheck disable=SC1090


#
# Basics
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

# Load shell-agnostic configs
source ~/.shellrc

# Vim mode
set -o vi
bind C-l:clear-screen

HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/bash/bash_history"
[ ! -d "$(dirname "$HISTFILE")" ] && mkdir -p "$(dirname "$HISTFILE")"


#
# Prompt
#

if [ -z "$_IS_SSH" ]; then
	_PROMPT_PRIMARY_COLOUR="\[\033[1;34m"
	_PROMPT_SECONDARY_COLOUR="\[\033[1;32m"
else
	_PROMPT_PRIMARY_COLOUR="\[\033[1;32m"
	_PROMPT_SECONDARY_COLOUR="\[\033[1;34m"
fi
[ -n "$_IS_ROOT" ] && _PROMPT_PRIMARY_COLOUR="\[\033[1;31m"

export PS1="${_PROMPT_PRIMARY_COLOUR}\]\u@\h \[\033[0min\] ${_PROMPT_SECONDARY_COLOUR}\]\w\n\[\033[0m\]\$ "