From 8fd263648f772783767ab6eab0ee25ac8772dcab Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 20 Apr 2015 19:25:41 -0400 Subject: bash: aliases should just be a regular rc module --- .config/bash/aliases.sh | 54 -------------------------------------------- .config/bash/rc.d/aliases.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++ .config/bash/rc.sh | 5 ---- 3 files changed, 54 insertions(+), 59 deletions(-) delete mode 100644 .config/bash/aliases.sh create mode 100644 .config/bash/rc.d/aliases.sh diff --git a/.config/bash/aliases.sh b/.config/bash/aliases.sh deleted file mode 100644 index 28b9923..0000000 --- a/.config/bash/aliases.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# The above line probably should never be *used* in this file, but it -# lets text editors know that this is BASH syntax. - -###################################################################### -# Set up colors and settings for ls/dir/vdir # -###################################################################### -if [ -x "`which dircolors`" ]; then - eval "$(dircolors -p | cat - "${XDG_CONFIG_HOME}/dir_colors" | - dircolors -b -)" - alias ls='ls -1v --color=auto' - alias dir='dir -v --color=auto' - alias vdir='vdir -v --color=auto' - - for xgrep in ${PATH//:/\/*grep }/*grep; do - if [ -f "$xgrep" ]; then - xgrep=`basename "$xgrep"` - if [ "$xgrep" != pgrep ]; then - alias $xgrep="$xgrep --color=auto" - fi - fi - done -else - alias ls='ls -1v' - alias dir='dir -v' - alias vdir='vdir -v' -fi - -###################################################################### -# Set up the standard aliases for ls # -###################################################################### -alias ll='ls -l' -alias la='ls -a' -alias l='ls -CF' - -###################################################################### -# Some preferences for miscellaneous stuff # -###################################################################### -#alias rm='gvfs-trash' -#alias sed='sed --follow-symlinks' # breaks sed 4.2.2 -alias tree='tree --charset utf8' -alias cd=pushd -alias gitk='gitk --all --date-order' -alias userctl='systemctl --user' - -###################################################################### -# Some almost-function aliases # -###################################################################### -alias lock="clear; away -C 'This terminal is locked'" -alias plock="term-title Terminal Locked;lock" -mvln() { mv $1 $2; ln -s $2 $1; } -jarls() { jar tf "$1" | sed -n 's/\.class$//p' | LC_ALL=C sort | xargs -r -d $'\n' javap -classpath "$1"; } -tarls() { local file; for file in "$@"; do bsdtar tf "$file" | sed "s|^|$file:|"; done; } -jarmain() { jarls "$1" 2>/dev/null | grep -E '(^[a-z]|public static void main\(java\.lang\.String\[\]\))' | grep -B1 '^ '; } diff --git a/.config/bash/rc.d/aliases.sh b/.config/bash/rc.d/aliases.sh new file mode 100644 index 0000000..28b9923 --- /dev/null +++ b/.config/bash/rc.d/aliases.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# The above line probably should never be *used* in this file, but it +# lets text editors know that this is BASH syntax. + +###################################################################### +# Set up colors and settings for ls/dir/vdir # +###################################################################### +if [ -x "`which dircolors`" ]; then + eval "$(dircolors -p | cat - "${XDG_CONFIG_HOME}/dir_colors" | + dircolors -b -)" + alias ls='ls -1v --color=auto' + alias dir='dir -v --color=auto' + alias vdir='vdir -v --color=auto' + + for xgrep in ${PATH//:/\/*grep }/*grep; do + if [ -f "$xgrep" ]; then + xgrep=`basename "$xgrep"` + if [ "$xgrep" != pgrep ]; then + alias $xgrep="$xgrep --color=auto" + fi + fi + done +else + alias ls='ls -1v' + alias dir='dir -v' + alias vdir='vdir -v' +fi + +###################################################################### +# Set up the standard aliases for ls # +###################################################################### +alias ll='ls -l' +alias la='ls -a' +alias l='ls -CF' + +###################################################################### +# Some preferences for miscellaneous stuff # +###################################################################### +#alias rm='gvfs-trash' +#alias sed='sed --follow-symlinks' # breaks sed 4.2.2 +alias tree='tree --charset utf8' +alias cd=pushd +alias gitk='gitk --all --date-order' +alias userctl='systemctl --user' + +###################################################################### +# Some almost-function aliases # +###################################################################### +alias lock="clear; away -C 'This terminal is locked'" +alias plock="term-title Terminal Locked;lock" +mvln() { mv $1 $2; ln -s $2 $1; } +jarls() { jar tf "$1" | sed -n 's/\.class$//p' | LC_ALL=C sort | xargs -r -d $'\n' javap -classpath "$1"; } +tarls() { local file; for file in "$@"; do bsdtar tf "$file" | sed "s|^|$file:|"; done; } +jarmain() { jarls "$1" 2>/dev/null | grep -E '(^[a-z]|public static void main\(java\.lang\.String\[\]\))' | grep -B1 '^ '; } diff --git a/.config/bash/rc.sh b/.config/bash/rc.sh index 7df0373..ae55d5c 100644 --- a/.config/bash/rc.sh +++ b/.config/bash/rc.sh @@ -71,11 +71,6 @@ unset make_prompt ################################################################################ -# Load my aliases -if [[ -f ${XDG_CONFIG_HOME}/bash/aliases.sh ]]; then - . ${XDG_CONFIG_HOME}/bash/aliases.sh -fi - # Include modular config files if [[ -d ${XDG_CONFIG_HOME}/bash/rc.d ]]; then for file in "${XDG_CONFIG_HOME}/bash/rc.d"/*.sh; do -- cgit v1.1-4-g5e80