Created
August 24, 2020 19:00
-
-
Save cgons/45efd0ef454dd0f8656f3dae21ae5804 to your computer and use it in GitHub Desktop.
Simple Bash Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# If set, the pattern "**" used in a pathname expansion context will | |
# match all files and zero or more directories and subdirectories. | |
shopt -s globstar | |
# make less more friendly for non-text input files, see lesspipe(1) | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.bash_aliases, instead of adding them here directly. | |
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
# if [ -f ~/.bash_aliases ]; then | |
# . ~/.bash_aliases | |
# fi | |
# 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). | |
if ! shopt -oq posix; then | |
if [ -f /usr/share/bash-completion/bash_completion ]; then | |
. /usr/share/bash-completion/bash_completion | |
elif [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
fi | |
# ----------------------------------------------- | |
# Aliases | |
# ------- | |
alias ls='ls -a --color' | |
alias l='ls -lah --color' | |
alias ll='ls -lAFh --color' | |
alias lh="ll | awk '{print \$5,\$9}'" | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
alias activate="source ./venv/bin/activate" | |
# alias cat="bat --style=grid,header" | |
alias weather="curl -s https://wttr.in/Toronto | head -n -2" | |
# Enable command history (up/down arrow keys) | |
bind '"\e[A":history-search-backward' | |
bind '"\e[B":history-search-forward' | |
bind 'set show-all-if-ambiguous on' | |
# bind 'set completion-ignore-case on' | |
# Setup Prompt | |
# ------ | |
darkgrey='\[\033[01;38;5;244m\]' | |
grey='\[\033[01;38;5;248m\]' | |
yellow='\[\033[01;38;5;185m\]' | |
reset='\[\033[0m\]' | |
gitbranchname() { | |
branchname=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) | |
if [ ! -z "$branchname" ] | |
then | |
echo "($branchname) " | |
fi | |
} | |
export PS1="$darkgrey\h $grey[\w]$yellow \$(gitbranchname)\$$reset " | |
# Env. Vars. | |
# ---------- | |
export PATH="$HOME/.local/bin:$PATH" | |
# Functions | |
# --------- | |
termcolours() { | |
for i in {0..255}; do printf "\x1b[38;5;${i}mcolor%-5i\x1b[0m" $i ; if ! (( ($i + 1 ) % 8 )); then echo ; fi ; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment