From 148ef39a6f3f9f933f6b62e7adaa9d55876374b3 Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Mon, 11 Apr 2016 12:27:46 -0500 Subject: [PATCH] Clean up formatting, added awman coloring, only use powerline if not using a TTY --- .bash_profile | 3 ++- .bashrc | 41 +++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.bash_profile b/.bash_profile index 30f35d7..9f589e5 100644 --- a/.bash_profile +++ b/.bash_profile @@ -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 diff --git a/.bashrc b/.bashrc index e0332ef..3e7b756 100644 --- a/.bashrc +++ b/.bashrc @@ -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' +