bash/bashrc

61 lines
2.0 KiB
Bash
Raw Normal View History

2022-03-12 17:13:43 +00:00
export SHELL_CONFIG="$SHELL_CONFIG:.bashrc"
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export HISTCONTROL=ignoreboth:erasedups
2022-03-12 17:36:58 +00:00
[ -f "$HOME/.config/bash/gitstatus/gitstatus.prompt.sh" ] && . "$HOME/.config/bash/gitstatus/gitstatus.prompt.sh"
PS1='\t \[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]${GITSTATUS_PROMPT:+ $GITSTATUS_PROMPT}\n\[\033[01;$((31+!$?))m\]\$\[\033[00m\] \[\e]0;\u@\h: \w\a\]'
2022-03-12 17:13:43 +00:00
2022-03-12 17:58:46 +00:00
# If there are multiple matches for completion, Tab should cycle through them
bind TAB:menu-complete
# Display a list of the matching files
bind "set show-all-if-ambiguous on"
# Perform partial (common) completion on the first Tab press, only start
# cycling full results on the second Tab press (from bash version 5)
bind "set menu-complete-display-prefix on"
2022-03-12 17:13:43 +00:00
source ~/.profile
export NVM_DIR="$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
2022-03-13 18:49:36 +00:00
# https://github.com/skywind3000/z.lua
eval "$(lua $HOME/.z.lua/z.lua --init bash enhanced once echo)"
2022-03-22 13:00:31 +00:00
_mem_available=$(awk '/MemAvailable/ { printf "%.1f \n", $2/1024/1024 }' /proc/meminfo)
2022-03-22 15:43:36 +00:00
_updates_available="$(wc -l $HOME/.checkupdates | cut -d' ' -f1)"
2022-03-22 13:00:31 +00:00
[ -z $_updates_available ] && _updates_available="0"
2022-03-22 15:43:36 +00:00
echo "Remember your commands:"
2022-05-12 11:59:37 +00:00
echo " cheat vimv 'flameshot gui' mid3v2 zathura tesseract"
2022-03-22 15:44:06 +00:00
echo ""
2022-03-22 15:43:36 +00:00
2022-03-22 13:00:31 +00:00
if [ ${_mem_available%.*} -lt 5 ] ; then
echo -n "Memory available: "
[ ${_mem_available%.*} -lt 3 ] && echo -ne "\033[0;31m"
echo -n "${_mem_available}"
[ ${_mem_available%.*} -lt 3 ] && echo -ne "\033[0m"
echo "GB"
fi
if [ $_updates_available -gt 0 ] ; then
echo -n "Updates available: "
2022-06-15 14:59:01 +00:00
[ $_updates_available -gt 29 ] && echo -ne "\033[0;31m"
2022-03-22 13:00:31 +00:00
echo -n "$_updates_available"
2022-06-15 14:59:01 +00:00
[ $_updates_available -gt 29 ] && echo -ne "\033[0m"
2022-03-22 13:00:31 +00:00
echo ""
fi
echo ""
2022-05-22 10:40:07 +00:00
. "$HOME/.config/bash/cheat.bash"
2022-03-22 13:00:31 +00:00
(checkupdates > "$HOME/.checkupdates") & disown
2022-08-19 13:35:40 +00:00
. "$HOME/.cargo/env"