config/bash/.bash_helpers.sh

66 lines
1.3 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
# If asdf is installed, set up completion for it
if [[ -e "$HOME/.asdf" ]]; then
source $HOME/.asdf/asdf.sh
source $HOME/.asdf/completions/asdf.bash
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 -
}