bashrc: Rename
This commit is contained in:
parent
1f6da7eca4
commit
4de10a89fa
1 changed files with 7 additions and 2 deletions
105
bash/bashrc
Normal file
105
bash/bashrc
Normal file
|
@ -0,0 +1,105 @@
|
|||
#!/bin/bash
|
||||
#===============================================================================
|
||||
# bash config for niblock :: source ~/.bashrc
|
||||
#===============================================================================
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
#===============================================================================
|
||||
# Prompt
|
||||
#===============================================================================
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
export PS1="\t \u@\h:\w \$"
|
||||
else
|
||||
mp_time="\[\$(tput setaf 6)\][ \t ]"
|
||||
mp_who="\[\$(tput setaf 2)\]\u\[\$(tput setaf 7)\]@\\[\$(tput setaf 2)\]\h"
|
||||
mp_whr="\[\$(tput setaf 7)\]:\[\$(tput setaf 5)\]\w"
|
||||
mp_git="\[\$(tput sgr0)\]\[\$(show_git_info)\] "
|
||||
export PS1="$mp_time $mp_who$mp_whr$mp_git\n\$ "
|
||||
fi
|
||||
#===============================================================================
|
||||
# Aliases
|
||||
#===============================================================================
|
||||
alias tssh="source ~/.ssh/auth_ssh; ssh -A"
|
||||
complete -F _ssh tssh
|
||||
#===============================================================================
|
||||
# Functions
|
||||
#===============================================================================
|
||||
#If redshift wasn't automatically started, this will do it
|
||||
function tint(){
|
||||
type redshift >/dev/null 2>&1
|
||||
if [[ $? == 0 ]]; then
|
||||
redshift -l 42.8864500:-78.8783700 -t 5000:4000 &
|
||||
else
|
||||
echo "Redshift not installed"
|
||||
fi
|
||||
}
|
||||
# Function for keeping ssh-agent happy
|
||||
function yssh(){
|
||||
echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > ~/.ssh/auth_ssh
|
||||
}
|
||||
# Determine git branch and index status
|
||||
function show_git_info(){
|
||||
local results=""
|
||||
type git >/dev/null 2>&1
|
||||
if [[ $? == 0 ]] ; then
|
||||
local bn=$(git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n')
|
||||
if [[ -n "$bn" ]] ; then
|
||||
git diff-index --quiet HEAD --
|
||||
if [[ $? == 0 ]] ; then
|
||||
results="#$(tput setaf 2)$bn$(tput sgr0)"
|
||||
else
|
||||
results="#$(tput setaf 1)$bn$(tput sgr0)"
|
||||
fi
|
||||
fi
|
||||
echo $results
|
||||
fi
|
||||
}
|
||||
# Start tmux session: Sojourner
|
||||
function sojourner_tmux(){
|
||||
type tmux >/dev/null 2>&1
|
||||
if [[ $? == 0 ]]; then
|
||||
tmux has-session -t Sojourner &>/dev/null
|
||||
# If there is no session named Sojourner
|
||||
if [ $? != 0 ] ; then
|
||||
# Create a new session named Sojourner
|
||||
tmux new-session -s Sojourner -d -c ~/
|
||||
fi
|
||||
# Attack to the Sojourner session
|
||||
tmux attach -t Sojourner
|
||||
else
|
||||
echo "Tmux not installed."
|
||||
fi
|
||||
}
|
||||
#===============================================================================
|
||||
# Path
|
||||
#===============================================================================
|
||||
# rbenv
|
||||
PATH="$HOME/.rbenv/bin:$PATH"
|
||||
# Add Python to path
|
||||
PYTHONPATH="${PYTHONPATH}"
|
||||
export PYTHONPATH
|
||||
# RVM. Make sure this is the last PATH variable change.
|
||||
PATH="$PATH:$HOME/.rvm/bin"
|
||||
# Set it.
|
||||
export PATH
|
||||
#===============================================================================
|
||||
# Defaults
|
||||
#===============================================================================
|
||||
# Set editor, if Vim is available
|
||||
type vim >/dev/null 2>&1
|
||||
if [[ $? == 0 ]]; then
|
||||
export EDITOR=vim
|
||||
fi
|
||||
# History size and time-format
|
||||
export HISTSIZE=10000
|
||||
export HISTTIMEFORMAT="%s "
|
||||
#===============================================================================
|
||||
# Random Shit often auto-added
|
||||
#===============================================================================
|
||||
# Hook for desk activation
|
||||
[ -n "$DESK_ENV" ] && source "$DESK_ENV" || true
|
||||
|
||||
# Yubikey support
|
||||
export SSH_AUTH_SOCK=$HOME/.yubiagent/sock
|
Loading…
Add table
Add a link
Reference in a new issue