From cafb88ea568032e0b5bc88c9f3abc730b2871518 Mon Sep 17 00:00:00 2001 From: frosty Date: Wed, 24 Jul 2024 07:43:21 +0000 Subject: [PATCH] add bash configs --- .bash_profile | 5 +++++ .bashrc | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .bash_profile create mode 100644 .bashrc diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..279b2f1 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,5 @@ +[ -f "$HOME/.bashrc" ] && . "$HOME/.bashrc" + +export EDITOR="vim" + +export PATH="$PATH:$HOME/.bin" diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..009c4cd --- /dev/null +++ b/.bashrc @@ -0,0 +1,33 @@ +case $- in + *i*) ;; + *) return ;; +esac + +# Default options +alias ls='ls --color=auto -AF' +alias grep='grep --color=auto' + +# Shorthands +alias l='ls' +alias c='cd' +alias v='vim' + +# Other options +alias ll='ls -l' + +# List files on 'cd' +cd() { + builtin cd "$@" + ls +} + +# Prompt +parse_git_dirty() { + [ -n "$(git status --porcelain 2>/dev/null)" ] && echo "*" +} + +parse_git_branch() { + git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1$(parse_git_dirty))/" +} + +export PS1="\n\[\e[36m\]\t\[\e[m\] \[\e[31m\]\h\[\e[m\] \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "