From 2faa1e480a83bc042774d1afc42b1f60b3079e7e Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Thu, 21 Jan 2016 13:42:34 -0600 Subject: [PATCH] Added if statement for pkgfile, syntax highlighting for less, added weechat alias. --- .bashrc | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/.bashrc b/.bashrc index f717323..1225ee0 100644 --- a/.bashrc +++ b/.bashrc @@ -3,17 +3,32 @@ # # Thurstylark +### MISC ### + # If not running interactively, don't do anything [[ $- != *i* ]] && return -export EDITOR=vim - # Don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth -# Enable pkgfile to automatically search for packages: -source /usr/share/doc/pkgfile/command-not-found.bash +# 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 + +# Enable less syntax hilighting if src-hilight is installed +if [[ -s /usr/bin/src-hilite-lesspipe.sh ]]; then + export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" + export LESS=' -R ' +fi # If a directory is given without any # command, CD into it. @@ -59,3 +74,18 @@ alias lsblk='lsblk -o NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT' # Always use sudo when using systemctl. Pairs well with passwordless sudo for systemctl. alias systemctl='sudo --preserve-env systemctl' + +# 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) + +# Only do this if weechat isn't installed and you aren't thurstyserv +if [[ ! -s /usr/bin/weechat ]]; then + # Connect to the existing screen session through mosh + # (disconnecting it elsewhere if necessary) + alias weechat='mosh home -- screen -dr weechat' +elif [[ "$HOSTNAME" -eq "thurstyserv" ]]; then + # Connect to the existing screen session locally + # (disconnecting it elsewhere if necessary) + alias weechat='screen -dr weechat' +fi