config/bash/.bash_helpers.sh

69 lines
1.4 KiB
Bash
Raw Normal View History

set_prompt() {
local BLUE="\[\e[0;34m\]"
local DARK_BLUE="\[\e[1;34m\]"
local RED="\[\e[0;31m\]"
local DARK_RED="\[\e[1;31m\]"
local GREEN="\[\e[0;32m\]"
local NO_COLOR="\[\e[0m\]"
case $TERM in
xterm*|screen)
TITLEBAR='\[\e]0;\u@\h \w\007\]';
;;
*)
TITLEBAR="";
;;
esac
FAILURE_COLOR="if [[ \$? = '0' ]]; then echo \"$GREEN\"; else echo \"$RED\"; fi"
PS1="${TITLEBAR}$BLUE[\t]\`$FAILURE_COLOR\` \u@\h> $NO_COLOR"
}
restart_network_manager() {
sudo service network-manager restart
}
configure_ls() {
PLATFORM=$(uname)
# makes ls print pretty
case $PLATFORM in
Linux)
alias ls="ls --color=auto"
;;
*)
alias ls="ls -G"
;;
esac
}
configure_completions() {
# If the gcloud sdk is installed, set up completion for it
if [[ -e "$HOME/.install/google-cloud-sdk" ]]; then
source $HOME/.install/google-cloud-sdk/completion.bash.inc
source $HOME/.install/google-cloud-sdk/path.bash.inc
fi
}
2019-03-12 21:38:21 +00:00
vimwiki() {
cd ~/Code/ntietz/vimwiki
git pull
2019-03-18 20:53:33 +00:00
nvim -c "VimwikiIndex"
2019-03-12 21:38:21 +00:00
git add -A
git commit -am "Auto-commit ($(date))"
git push
cd -
}
2020-04-17 13:57:42 +00:00
set_term_colors() {
2020-04-17 13:53:04 +00:00
bash -c "$(wget -qO- https://git.io/vQgMr)"
}
2020-04-17 13:57:42 +00:00
print_available_colors() {
for i in {0..255} ; do printf "\x1b[38;5;${i}mcolour${i}\n"; done
}