dotfiles/bashrc

80 lines
2.0 KiB
Bash
Raw Normal View History

2020-07-25 12:25:06 +02:00
#!/bin/bash
2018-07-15 09:47:03 +02:00
2018-07-15 10:24:42 +02:00
# Based on example .bashrc as provided by Debian
2018-07-15 09:47:03 +02:00
# If not running interactively, don't do anything
2020-07-25 17:09:58 +02:00
[[ -z "$PS1" ]] && return
# Environment variables go here
export LANG=en_US.UTF-8
export PATH=${HOME}/.local/share/perl5/bin:${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin
2018-07-15 10:24:42 +02:00
# History control
2018-07-15 09:47:03 +02:00
HISTCONTROL=ignoreboth
2020-07-25 12:25:06 +02:00
HISTSIZE=20000
2018-07-15 09:47:03 +02:00
2018-07-15 10:24:42 +02:00
# Append to the history file, don't overwrite it
2018-07-15 09:47:03 +02:00
shopt -s histappend
2018-07-15 10:24:42 +02:00
# Correctly save multiline commands in the history
shopt -s cmdhist
shopt -s lithist
2018-07-15 09:47:03 +02:00
# No clobbering
shopt -o -s noclobber
2018-07-15 10:41:58 +02:00
# Extended globbing
shopt -s extglob
2018-07-15 10:24:42 +02:00
# Check the window size after each command and, if necessary,
# Update the values of LINES and COLUMNS.
2018-07-15 09:47:03 +02:00
shopt -s checkwinsize
2018-07-15 10:24:42 +02:00
# make less more friendly for non-text input files, see lesspipe(1)
2020-07-25 17:09:58 +02:00
[[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)"
2018-07-15 09:47:03 +02:00
2019-06-01 21:45:25 +02:00
# Simple prompt
if [[ "$TERM" = "dumb" ]]; then
PS1="\u@\h:\w$ "
else
PURPLE="\e[0;35m"
YELLOW="\e[0;32m"
RED="\e[0;31m"
NOCOLOR="\e[m"
2020-07-25 11:58:18 +02:00
if [[ -f ~/.config/bash/git-prompt.sh ]]; then
GIT_PROMPT="\$(__git_ps1 \"${PURPLE}─(${NOCOLOR}%s${PURPLE})${NOCOLOR}\")"
2020-07-25 11:58:18 +02:00
else
GIT_PROMPT=''
fi
PS1="┌\[${PURPLE}[${YELLOW}\u@\h${PURPLE}]─[${NOCOLOR}\w${PURPLE}]─[${NOCOLOR}\t${PURPLE}]${GIT_PROMPT}${NOCOLOR}\]\n└── "
unset GIT_PROMPT PURPLE YELLOW RED NOCOLOR
fi
2018-07-15 09:47:03 +02:00
2018-07-15 10:24:42 +02:00
# Enable color support of ls and also add handy aliases
2020-07-25 17:09:58 +02:00
if [[ -x /usr/bin/dircolors ]]; then
2020-07-25 12:25:06 +02:00
if [[ -r ~/.dircolors ]]; then
eval "$(dircolors -b ~/.dircolors)"
else
eval "$(dircolors -b)"
fi
2018-07-15 10:24:42 +02:00
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
2018-07-15 09:47:03 +02:00
fi
2018-07-15 10:24:42 +02:00
# Some more ls aliases
2018-07-15 09:47:03 +02:00
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias ..='cd ..'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
2020-07-25 17:09:58 +02:00
if [[ -f /etc/bash_completion ]] && ! shopt -oq posix; then
2018-07-15 09:47:03 +02:00
. /etc/bash_completion
fi