Created
February 3, 2023 07:56
-
-
Save Aadv1k/934c0d6da53b20a687a3b1cf5e778e6e to your computer and use it in GitHub Desktop.
A functional bashrc
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
#!/bin/bash | |
## CONFIG | |
HISTSIZE=5000 | |
HISTFILESIZE=5000 | |
set -o vi | |
## ALIASES | |
winp="/mnt/c/users/aadv1k/" | |
winhome="/mnt/c/" | |
alias winr="powershell.exe" | |
alias wslp="echo file://///wsl.localhost/Debian`pwd`" | |
alias alaconf="nvim $winp/AppData/Roaming/Alacritty/alacritty.yml" | |
alias wtconf="nvim $winp/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json" | |
alias mpg123="$winhome/Tools/mpg123/mpg123.exe -C " | |
alias ls='ls --color=no' | |
alias nvim="/usr/bin/nvim/bin/nvim" | |
alias play="clear && ascii-image-converter ./cover* --color -d 60,30 && mpg123 -q -Z *.mp3" | |
alias log="{ time cat > /dev/null 2>&1 ; } 2>> ~/.timelog" | |
alias view-img="ascii-image-converter --color -b" | |
## FUNCS | |
search() { | |
opts=$@ | |
q=`echo $opts | tr ' ' '+'` | |
ddg='https://lite.duckduckgo.com/lite?q=' | |
google='https://www.google.com/search?q=' | |
query=${ddg}${q} | |
lynx -vikeys "$query" | |
} | |
ex() { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.gz) | |
tar xzf $1 | |
;; | |
*.tar) | |
tar xf $1 | |
;; | |
*.zip) | |
unzip $1 | |
;; | |
esac | |
else | |
echo '$1 could not be extracted' | |
fi | |
} | |
## PROMPT CUSTOMIZATION | |
RED="\[\e[31m\]" | |
GREEN="\[\e[32m\]" | |
YELLOW="\[\e[33m\]" | |
BLUE="\[\e[34m\]" | |
CYAN="\[\e[35m\]" | |
MAGENTA="\[\e[36m\]" | |
GRAY="\[\e[90m\]" | |
ENDCOLOR="\[\e[0m\]" | |
CURRENT="${RED}[${ENDCOLOR}${YELLOW}\u${ENDCOLOR}${MAGENTA}@${ENDCOLOR}${GREEN}\h${ENDCOLOR} ${CYAN}\W${ENDCOLOR}${RED}]${ENDCOLOR}\n" | |
PS1="${CURRENT}\`if [ \$? = 0 ]; then echo ${MAGENTA}\>${ENDCOLOR}; else echo ${RED}X${ENDCOLOR}; fi\` ${ENDCOLOR}" | |
## NVM | |
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment