From 16a147d9881067290ab961219b3227c4f1d7dfa6 Mon Sep 17 00:00:00 2001 From: Johannes Randerath Date: Mon, 6 May 2024 21:04:37 +0200 Subject: [PATCH] Inititial commit --- bashrc | 34 ++++++++++++++++++++++++++++++++++ l1/aliasrc | 12 ++++++++++++ l1/calrc | 12 ++++++++++++ l1/colorrc | 19 +++++++++++++++++++ l1/generalrc | 1 + l1/historyrc | 6 ++++++ l1/promptrc | 25 +++++++++++++++++++++++++ 7 files changed, 109 insertions(+) create mode 100644 bashrc create mode 100644 l1/aliasrc create mode 100644 l1/calrc create mode 100644 l1/colorrc create mode 100644 l1/generalrc create mode 100644 l1/historyrc create mode 100644 l1/promptrc diff --git a/bashrc b/bashrc new file mode 100644 index 0000000..2d34faa --- /dev/null +++ b/bashrc @@ -0,0 +1,34 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# User specific environment +if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then + PATH="$HOME/.local/bin:$HOME/bin:$PATH" +fi +export PATH + +# Uncomment the following line if you don't like systemctl's auto-paging feature: +# export SYSTEMD_PAGER= + +# User specific aliases and functions +if [ -d ~/.bashrc.d/l0/ ]; then + for rc in ~/.bashrc.d/l0/*; do + if [ -f "$rc" ]; then + . "$rc" + fi + done +fi +unset rc +if [ -d ~/.bashrc.d/l1/ ]; then + for rc in ~/.bashrc.d/l1/*; do + if [ -f "$rc" ]; then + . "$rc" + fi + done +fi +unset rc + diff --git a/l1/aliasrc b/l1/aliasrc new file mode 100644 index 0000000..815d59c --- /dev/null +++ b/l1/aliasrc @@ -0,0 +1,12 @@ +alias ls='ls -lhia --color=auto' +alias vi=nvim +alias sudo="sudo " +alias grep='grep --color=auto' +alias tree='tree --dirsfirst -F' +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias h=history +alias mkdir='mkdir -pv' + + diff --git a/l1/calrc b/l1/calrc new file mode 100644 index 0000000..7fd8817 --- /dev/null +++ b/l1/calrc @@ -0,0 +1,12 @@ +alias jan='cal -m 01' +alias feb='cal -m 02' +alias mar='cal -m 03' +alias apr='cal -m 04' +alias may='cal -m 05' +alias jun='cal -m 06' +alias jul='cal -m 07' +alias aug='cal -m 08' +alias sep='cal -m 09' +alias oct='cal -m 10' +alias nov='cal -m 11' +alias dec='cal -m 12' diff --git a/l1/colorrc b/l1/colorrc new file mode 100644 index 0000000..d372e05 --- /dev/null +++ b/l1/colorrc @@ -0,0 +1,19 @@ +blk='\[\033[01;30m\]' # Black +red='\[\033[01;31m\]' # Red +grn='\[\033[01;32m\]' # Green +ylw='\[\033[01;33m\]' # Yellow +blu='\[\033[01;34m\]' # Blue +pur='\[\033[01;35m\]' # Purple +cyn='\[\033[01;36m\]' # Cyan +wht='\[\033[01;37m\]' # White +clr='\[\033[00m\]' # Reset + +blk_fn='\033[01;30m' # Black +red_fn='\033[01;31m' # Red +grn_fn='\033[01;32m' # Green +ylw_fn='\033[01;33m' # Yellow +blu_fn='\033[01;34m' # Blue +pur_fn='\033[01;35m' # Purple +cyn_fn='\033[01;36m' # Cyan +wht_fn='\033[01;37m' # White +clr_fn='\033[00m' # Reset diff --git a/l1/generalrc b/l1/generalrc new file mode 100644 index 0000000..4b7ff4c --- /dev/null +++ b/l1/generalrc @@ -0,0 +1 @@ +set -o vi diff --git a/l1/historyrc b/l1/historyrc new file mode 100644 index 0000000..98c287a --- /dev/null +++ b/l1/historyrc @@ -0,0 +1,6 @@ +HISTCONTROL=ignoredups +HISTSIZE=2000 +HISTFILESIZE=2000 +HISTTIMEFORMAT="%F %T " +shopt -s histappend + diff --git a/l1/promptrc b/l1/promptrc new file mode 100644 index 0000000..f02d483 --- /dev/null +++ b/l1/promptrc @@ -0,0 +1,25 @@ +function is_git_repo() { + if [ -d .git ]; then + return 0; + fi + return 1; +} + +function get_git_branch() { + if is_git_repo ; then + printf "($(git status 2> /dev/null | awk '/branch /{print $3; exit;}'))" + fi +} + +function get_git_up2date() { + if is_git_repo ; then + if [ $(git status 2>/dev/null | awk '/nothing to commit, working tree clean/{print $1}') ]; then + printf ${grn_fn}; + else + printf ${red_fn}; + fi + fi +} + + +PS1=${ylw}'\u:'${blu}'\W '${wht}'$(get_git_branch)\[$(get_git_up2date)\]\$ '${clr}