Files
.dotfiles/.bashrc
2025-05-30 15:34:12 +02:00

90 lines
2.5 KiB
Bash

#!/bin/bash
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
[[ -z "${PS1-}" ]] && return
# check the window size after each command (and if necessary, the values of LINES and COLUMNS)
shopt -s checkwinsize
# history settings
HISTCONTROL=ignoreboth # don't put duplicate lines or lines starting with space in the history.
HISTSIZE=1000
HISTFILESIZE=2000
source /usr/share/bash-completion/completions/git
source /usr/share/git/completion/git-prompt.sh
PS1=
PS1="$PS1"'\[\033[01;35m\]\u@\h' # user@host
PS1="$PS1"'\[\033[00m\]:' # seperator
PS1="$PS1"'\[\033[01;34m\]\w' # working directory
PS1="$PS1"'\[\033[01;93m\]$(__git_ps1)' # github branch
PS1="$PS1"'\[\033[00m\]\$ ' # shell sign
export EDITOR=nvim
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # coloured GCC warnings and errors
eval "$(_AUTO_CPUFREQ_COMPLETE=bash_source auto-cpufreq)"
#
# aliases
#
# aliases for colour
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias ls='eza -Abhg --colour=auto'
alias grep='grep --colour=auto'
alias diff='diff --color'
alias ip='ip -c'
# application aliases
alias ncdu='ncdu --color=dark -t 16'
alias hyfetch='hyfetch --ascii-file $HOME/.config/hyfetch-ascii'
alias bat='bat --wrap never --tabs 4 --theme gruvbox-dark'
alias make='make -j'
# aliases to avoid mistakes
alias cp='cp -i'
alias mv='mv -i'
#alias rm='rm -i'
alias :qa='exit'
alias :q='exit'
alias py3='python3'
alias hgit='git --git-dir=$HOME/.home-conf.git --work-tree=$HOME'
__git_complete hgit __git_main
# vcpkg shit
export VCPKG_ROOT=$HOME/.local/share/vcpkg
export PATH=$VCPKG_ROOT:$PATH
source /home/user/.local/share/vcpkg/scripts/vcpkg_completion.bash
# opt out of Microsoft's telemetry bullshit
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export VCPKG_DISABLE_METRICS=1
# customise less
# Have less display colours
# from: https://wiki.archlinux.org/index.php/Color_output_in_console#man
export LESS_TERMCAP_mb=$'\e[1;31m' # begin bold
export LESS_TERMCAP_md=$'\e[1;33m' # begin blink
export LESS_TERMCAP_so=$'\e[01;44;37m' # begin reverse video
export LESS_TERMCAP_us=$'\e[01;37m' # begin underline
export LESS_TERMCAP_me=$'\e[0m' # reset bold/blink
export LESS_TERMCAP_se=$'\e[0m' # reset reverse video
export LESS_TERMCAP_ue=$'\e[0m' # reset underline
# customise man pager to use the correct parameters
export MANPAGER='less -s -M +Gg'
# cute lil hyfetch :3
if [[ $TERM == "xterm-kitty" ]]; then
hyfetch
fi