Clean up formatting, added awman coloring, only use powerline if not using a TTY

This commit is contained in:
David Thurstenson 2016-04-11 12:27:46 -05:00
parent 73d31d2973
commit 148ef39a6f
2 changed files with 23 additions and 21 deletions

View File

@ -8,5 +8,6 @@
# Set numlock if running in tty.
# (numlock for X is set in ~/.xinitrc)
case $(tty) in /dev/tty[0-9]*)
setleds -D +num ;;
setleds -D +num
export USING_TTY=1 ;;
esac

41
.bashrc
View File

@ -9,12 +9,12 @@
[[ $- != *i* ]] && return
# Use powerline if it's installed
if [[ -s /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh ]];then
[ -z "$USING_TTY" -a -s "/usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh" ] && {
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh
fi
}
# Don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
@ -25,16 +25,10 @@ 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;4
export LS_COLORS
# 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
[[ -s /usr/bin/vim ]] && export EDITOR=vim || export EDITOR=nano
# 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
[[ -s /usr/share/doc/pkgfile/command-not-found.bash ]] && source /usr/share/doc/pkgfile/command-not-found.bash
# If a directory is given without any
# command, CD into it.
@ -52,6 +46,18 @@ man() {
man "$@"
}
# Do the same for awman
awman() {
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' \
awman "$@"
}
### PROMPT ###
@ -88,13 +94,8 @@ alias nmap='sudo -E nmap'
# Client depends: ssh, mosh, correct ssh host configuration
# Server depends: ssh, mosh, screen, weechat, weechat.service (custom)
# Only do this if weechat isn't installed and you aren't thurstylark-vps
if [[ ! -s /usr/bin/weechat ]]; then
# Connect to the existing screen session through mosh
# (disconnecting it elsewhere if necessary)
alias weechat='mosh vps -- screen -dr weechat'
elif [[ "$HOSTNAME" -eq "thurstylark-vps" ]]; then
# Connect to the existing screen session locally
# (disconnecting it elsewhere if necessary)
alias weechat='screen -dr weechat'
fi
# If you don't have weechat installed, connect to the existing screen session through mosh
[[ ! -s /usr/bin/weechat ]] && alias weechat='mosh vps -- screen -dr weechat'
# If you are thurstylark-vps, connect to the existing screen session locally
[[ "$HOSTNAME" = "thurstylark-vps" ]] && alias weechat='screen -dr weechat'