From 2d3415003dfd7f997a1c6789c2daa1fd90cb17db Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Thu, 9 Jun 2016 23:30:10 +0200 Subject: [PATCH] Shell: Remove old funcs, aliases, Zsh power aliases --- .shell.d/alias_rc | 15 --------- .shell.d/funs_rc | 81 +++++++++-------------------------------------- 2 files changed, 15 insertions(+), 81 deletions(-) diff --git a/.shell.d/alias_rc b/.shell.d/alias_rc index b9d16e68..656483ba 100644 --- a/.shell.d/alias_rc +++ b/.shell.d/alias_rc @@ -31,7 +31,6 @@ alias ll='ls -lh' # Detailed view with human readable values. alias lx='ls -lXh' # Sort by extension ## Misc -alias xlx='xrdb -load ~/.Xresources' alias grep='grep --color=auto' # List desktop applications. @@ -66,19 +65,6 @@ command -v udiskie-umount >/dev/null 2>&1 && alias uua='udiskie-umount -a' ## Emacs command -v emacsclient >/dev/null 2>&1 && alias emacs-kill="emacsclient -e '(kill-emacs)' >/dev/null 2>&1" -##============================================================================== -## Zsh power aliases - -#if [ "zsh" = "$SHELL_CURRENT" ]; then -## Inline aliases, zsh -g aliases can be anywhere in command line -#alias -g G='| grep -' -#alias -g L='| less' - -## Now just type the image name to launch your image preview -#alias -s jpg='/usr/bin/sxiv' - -# fi - ##============================================================================== ## Pacman aliases @@ -133,6 +119,5 @@ if [ -d "/usr/local/texlive" ]; then alias tll="comm -3 <(tlmgr info --only-installed | grep -v 'x86_64\|amd64' | cut -d' ' -f2 | cut -f1 -d':' | sort) \ <(tlmgr info collection-basic --list | sed -n '/^ /{s/ //g;p;}' | sort) \ | sed 's/ //g' | grep -vi 'collection-basic\|scheme-minimal\|texlive-common\|texlive-docindex\|texlive-en'" - alias tlf="tlmgr info --list" fi diff --git a/.shell.d/funs_rc b/.shell.d/funs_rc index 2cff42f5..3c66805a 100644 --- a/.shell.d/funs_rc +++ b/.shell.d/funs_rc @@ -96,7 +96,7 @@ if command -v highlight >/dev/null 2>&1; then hlt-viewer () { local SAMPLE DUMMY - _usage () + local usage () { cat<= 1.4.2. +# +# To undo the effect of this function, you can type "cd -" to return to the +# original directory. browse () { - # Compatible with ranger 1.4.2 through 1.6.* - # - # Automatically change the directory in bash after closing ranger. - # - # This is a shell wrapper script to automatically change the directory to the - # last visited one after ranger quits. To undo the effect of this function, you - # can type "cd -" to return to the original directory. - - tempfile="$(mktemp)" + local tempfile="$(mktemp)" ranger --choosedir="$tempfile" "${@:-$(pwd)}" if [ -f "$tempfile" ] && [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then cd -- "$(cat "$tempfile")" @@ -222,9 +180,8 @@ browse () { rm -f -- "$tempfile" } -## Webcam testing +## Webcam testing with an mplayer-like player. webcam () { - ## With mplayer-like player. mpv --tv driver=v4l2:width=640:height=480:device=/dev/video0 tv:// } @@ -256,7 +213,6 @@ xmultioff () { ##============================================================================== ## Pacman functions -##============================================================================== if command -v pacman >/dev/null 2>&1; then ## Get detailed file list for the specified packages, omitting folders. @@ -271,10 +227,9 @@ fi ##============================================================================== ## FreeBSD functions -##============================================================================== if [ "$(uname)" = FreeBSD ]; then - ## TODO: useless ? + ## TODO: Useless FreeBSD function? # mqs () { # local str="$(echo "$@" | sed -E 's/[ \t]+/\\|/g')" # (cd /usr/ports && make quicksearch name="$str") @@ -297,28 +252,22 @@ fi ##============================================================================== ## TeXlive functions -##============================================================================== -## TeXlive +## It is important to set umask properly, otherwise users might not have +## authorization to use the packages. + if [ -d "/usr/local/texlive" ]; then - ## WARNING: it is important to set umask properly, otherwise users might - ## not have authorization to use the packages. - - ## It is bad pratice to write args without double quotes, but since we are - ## sure there is no space in TeX Live packages, it is OK here. - tli () { - sudo sh -c 'umask 022 && tlmgr install $0 $@' "$@" + sudo sh -c 'umask 022 && tlmgr install $0 "$@"' "$@" } tlr () { - sudo sh -c 'umask 022 && tlmgr remove $0 $@' "$@" + sudo sh -c 'umask 022 && tlmgr remove $0 "$@"' "$@" } fi ##============================================================================== ## Luarocks functions -##============================================================================== if command -v luarocks >/dev/null 2>&1; then lri () {