2016-01-20 17:06:54 +00:00
|
|
|
#
|
|
|
|
# ~/.bashrc
|
|
|
|
#
|
|
|
|
# Thurstylark
|
|
|
|
|
2016-01-21 19:42:34 +00:00
|
|
|
### MISC ###
|
|
|
|
|
2016-01-20 17:06:54 +00:00
|
|
|
# If not running interactively, don't do anything
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
2016-03-31 17:09:10 +00:00
|
|
|
# Use powerline if it's installed
|
|
|
|
if [[ -s /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh ]];then
|
|
|
|
powerline-daemon -q
|
|
|
|
POWERLINE_BASH_CONTINUATION=1
|
|
|
|
POWERLINE_BASH_SELECT=1
|
|
|
|
. /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh
|
|
|
|
fi
|
|
|
|
|
2016-01-20 17:06:54 +00:00
|
|
|
# Don't put duplicate lines or lines starting with space in the history.
|
|
|
|
# See bash(1) for more options
|
|
|
|
HISTCONTROL=ignoreboth
|
|
|
|
|
2016-03-15 14:15:35 +00:00
|
|
|
# These are the default colors, but some other programs, such as tee(1), like to use this variable
|
|
|
|
LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
|
|
|
|
export LS_COLORS
|
|
|
|
|
2016-01-21 19:42:34 +00:00
|
|
|
# Prefer vim, but if it's not installed, nano will do
|
|
|
|
if [[ -s /usr/bin/vim ]]; then
|
|
|
|
export EDITOR=vim
|
|
|
|
else
|
|
|
|
export EDITOR=nano
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Enable pkgfile to automatically search for packages if pkgfile is installed
|
|
|
|
if [[ -s /usr/share/doc/pkgfile/command-not-found.bash ]];then
|
|
|
|
source /usr/share/doc/pkgfile/command-not-found.bash
|
|
|
|
fi
|
|
|
|
|
2016-01-20 17:06:54 +00:00
|
|
|
# If a directory is given without any
|
|
|
|
# command, CD into it.
|
|
|
|
shopt -s autocd
|
|
|
|
|
|
|
|
# Enables colored Man pages:
|
|
|
|
man() {
|
|
|
|
env LESS_TERMCAP_mb=$'\E[01;31m' \
|
|
|
|
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
|
|
|
|
LESS_TERMCAP_me=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_se=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_so=$'\E[38;5;246m' \
|
|
|
|
LESS_TERMCAP_ue=$'\E[0m' \
|
|
|
|
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
|
|
|
|
man "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
### PROMPT ###
|
|
|
|
|
|
|
|
# [hh:mm][username@hostname pwd]$
|
|
|
|
if [ -n "$SSH_CLIENT" ]; then
|
|
|
|
# Remotely, hostname is red.
|
|
|
|
PS1="\[\033[38;5;4m\][\A]\[$(tput sgr0)\]\[\033[38;5;6m\][\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;14m\]\u\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;6m\]@\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;1m\]\h\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;6m\] \W]\[$(tput sgr0)\]\[\033[38;5;7m\]\\$ \[$(tput sgr0)\]"
|
|
|
|
else
|
|
|
|
# Locally, hostname is cyan.
|
|
|
|
PS1="\[\033[38;5;4m\][\A]\[$(tput sgr0)\]\[\033[38;5;6m\][\[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;14m\]\u\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;6m\]@\h \W]\[$(tput sgr0)\]\[\033[38;5;7m\]\\$ \[$(tput sgr0)\]"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
### ALIASES ###
|
|
|
|
|
|
|
|
# Colorize all `ls` output:
|
2016-01-28 18:09:13 +00:00
|
|
|
alias ls='ls -AF --color=auto'
|
2016-01-20 17:06:54 +00:00
|
|
|
# Map "la" to `ls -la`
|
2016-01-28 18:09:13 +00:00
|
|
|
alias la='ls -laFh --color=auto'
|
2016-01-20 17:06:54 +00:00
|
|
|
|
|
|
|
# Colorize `grep` output
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
|
|
|
|
# Change layout of lsblk to include FSTYPE and remove MAJ:MIN, RM, and RO collumns.
|
|
|
|
alias lsblk='lsblk -o NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT'
|
|
|
|
|
|
|
|
# Always use sudo when using systemctl. Pairs well with passwordless sudo for systemctl.
|
2016-01-21 22:21:30 +00:00
|
|
|
alias systemctl='sudo -E systemctl'
|
|
|
|
|
|
|
|
# Always use sudo when using nmap.
|
|
|
|
alias nmap='sudo -E nmap'
|
2016-01-21 19:42:34 +00:00
|
|
|
|
|
|
|
# I'm tired of managing weechat configs and multiple nicks
|
|
|
|
# Client depends: ssh, mosh, correct ssh host configuration
|
|
|
|
# Server depends: ssh, mosh, screen, weechat, weechat.service (custom)
|
|
|
|
|
2016-03-03 22:19:16 +00:00
|
|
|
# Only do this if weechat isn't installed and you aren't thurstylark-vps
|
2016-01-21 19:42:34 +00:00
|
|
|
if [[ ! -s /usr/bin/weechat ]]; then
|
|
|
|
# Connect to the existing screen session through mosh
|
|
|
|
# (disconnecting it elsewhere if necessary)
|
2016-03-03 22:19:16 +00:00
|
|
|
alias weechat='mosh vps -- screen -dr weechat'
|
|
|
|
elif [[ "$HOSTNAME" -eq "thurstylark-vps" ]]; then
|
2016-01-21 19:42:34 +00:00
|
|
|
# Connect to the existing screen session locally
|
|
|
|
# (disconnecting it elsewhere if necessary)
|
|
|
|
alias weechat='screen -dr weechat'
|
|
|
|
fi
|