2012-07-03 17:21:48 +02:00
|
|
|
## -*- mode:sh -*- #
|
2012-06-15 16:54:02 +02:00
|
|
|
################################################################################
|
|
|
|
## Shell Config -- Alias Definitions.
|
|
|
|
################################################################################
|
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Warning: if this does not work if you change shell without relogging, use
|
|
|
|
## 'source .<shell>rc' instead.
|
|
|
|
|
|
|
|
if [ "zsh" = "$SHELL_CURRENT" ]; then
|
2012-06-15 16:54:02 +02:00
|
|
|
alias ssrc='source ~/.zshrc'
|
|
|
|
fi
|
|
|
|
|
2012-06-21 17:34:18 +02:00
|
|
|
##==============================================================================
|
2013-03-03 00:01:20 +01:00
|
|
|
## General
|
2012-06-21 17:34:18 +02:00
|
|
|
##==============================================================================
|
|
|
|
|
2012-07-02 19:11:12 +02:00
|
|
|
## 'ls' redefinition
|
2012-10-29 15:29:54 +01:00
|
|
|
alias ls='ls -F'
|
|
|
|
|
|
|
|
## GNU extras.
|
|
|
|
if [ "$OSTYPE" = "linux-gnu" ]; then
|
|
|
|
alias ls='ls --color=auto -v --group-directories-first'
|
|
|
|
else
|
|
|
|
alias ls='ls -G'
|
|
|
|
fi
|
2012-07-02 19:11:12 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Listing aliases.
|
2012-07-02 19:11:12 +02:00
|
|
|
alias l='ls -1'
|
2012-10-29 15:29:54 +01:00
|
|
|
alias la='ls -lAh' # Hidden files
|
|
|
|
alias lc='ls -ltcrh' # Sort by change time
|
|
|
|
alias lk='ls -lSrh' # Sort by size
|
|
|
|
alias ll='ls -lh' # Detailed view with human readable values.
|
|
|
|
alias lx='ls -lXh' # Sort by extension
|
2012-07-02 19:11:12 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Misc
|
2012-07-13 17:39:09 +02:00
|
|
|
alias xlx='xrdb -load ~/.Xresources'
|
2012-06-15 16:54:02 +02:00
|
|
|
alias grep='grep --color=auto'
|
2012-10-31 14:09:03 +01:00
|
|
|
|
|
|
|
## Bad idea because you cannot toggle '-f' option anymore.
|
|
|
|
# alias cp="cp -i"
|
2013-05-11 21:16:57 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
# List desktop applications.
|
2012-10-29 15:29:54 +01:00
|
|
|
[ -d /usr/share/applications ] && XDG_APPS=($XDG_APPS /usr/share/applications)
|
|
|
|
[ -d /usr/local/share/applications ] && XDG_APPS=($XDG_APPS /usr/local/share/applications)
|
|
|
|
[ ${#XDG_APPS} -ne 0 ] && alias applist='grep -R "^Name=" $XDG_APPS | cut -d'=' -f2 | sort'
|
2012-06-21 17:34:18 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Remove executable attribute.
|
2013-12-27 11:17:55 +01:00
|
|
|
alias nox='find . -type f -exec chmod a-x {} +'
|
2012-06-21 17:34:18 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Get your external IP.
|
2014-01-03 19:13:07 +01:00
|
|
|
command -v curl >/dev/null 2>&1 && alias myip='curl ifconfig.me'
|
2012-06-21 17:34:18 +02:00
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Prevents accidentally clobbering files.
|
2012-06-21 17:34:18 +02:00
|
|
|
alias mkdir='mkdir -p'
|
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
## Reset terminal -- Faster alternative of 'reset'.
|
2012-06-21 17:34:18 +02:00
|
|
|
alias cls='printf "\ec"'
|
|
|
|
|
2013-11-14 12:33:35 +01:00
|
|
|
## Start X and lock current terminal (press ENTER when back in terminal to
|
|
|
|
## prompt for password). Useless if X is running on the same TTY.
|
2014-01-03 19:13:07 +01:00
|
|
|
command -v vlock >/dev/null 2>&1 && alias sx='startx & vlock'
|
2012-06-21 17:34:18 +02:00
|
|
|
|
2012-07-16 17:08:18 +02:00
|
|
|
## Zathura -- Fork to background.
|
2014-01-03 19:13:07 +01:00
|
|
|
command -v zathura >/dev/null 2>&1 && alias zat='zathura --fork'
|
2012-07-16 17:08:18 +02:00
|
|
|
|
2012-08-02 17:28:47 +02:00
|
|
|
## Xrandr
|
2012-10-02 19:14:14 +02:00
|
|
|
alias xmorphnone='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --transform none'
|
|
|
|
alias xmorphsw='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --transform 1.24,0.16,-124,0,1.24,0,0,0.000316,1'
|
|
|
|
alias xmorphzo='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --scale 1.2x1.2'
|
|
|
|
alias xmorphzi='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --scale 0.8x0.8'
|
2012-08-02 17:28:47 +02:00
|
|
|
|
2013-09-07 19:18:14 +02:00
|
|
|
alias xres='xrandr --output $(xrandr | awk '"'"'NR==2 {print $1;exit}'"'"') --auto && xrandr -s $(xrandr | awk '"'"'/^ / {print $1;exit}'"'"')'
|
2013-02-02 01:23:05 +01:00
|
|
|
|
2013-09-30 22:45:16 +02:00
|
|
|
## Udiskie
|
2014-01-03 19:13:07 +01:00
|
|
|
command -v udiskie-umount >/dev/null 2>&1 && alias uua='udiskie-umount -a'
|
2013-11-14 12:33:35 +01:00
|
|
|
|
|
|
|
## Emacs
|
2014-03-12 10:51:37 +01:00
|
|
|
command -v emacsclient >/dev/null 2>&1 && alias emacs-kill="emacsclient -e '(kill-emacs)' >/dev/null 2>&1"
|
2013-09-30 22:45:16 +02:00
|
|
|
|
2012-06-15 16:54:02 +02:00
|
|
|
##==============================================================================
|
|
|
|
## Zsh power aliases
|
|
|
|
##==============================================================================
|
|
|
|
|
2012-08-13 18:18:56 +02:00
|
|
|
#if [ "zsh" = "$SHELL_CURRENT" ]; then
|
2012-06-15 16:54:02 +02:00
|
|
|
## Inline aliases, zsh -g aliases can be anywhere in command line
|
|
|
|
#alias -g G='| grep -'
|
|
|
|
#alias -g L='| less'
|
|
|
|
|
2013-07-30 17:12:41 +02:00
|
|
|
## Now just type the image name to launch your image preview
|
2013-01-09 19:25:23 +01:00
|
|
|
#alias -s jpg='/usr/bin/sxiv'
|
2012-06-15 16:54:02 +02:00
|
|
|
|
|
|
|
# fi
|
|
|
|
|
|
|
|
##==============================================================================
|
2012-06-21 17:34:18 +02:00
|
|
|
## Pacman aliases
|
2012-06-15 16:54:02 +02:00
|
|
|
##==============================================================================
|
2014-01-03 19:13:07 +01:00
|
|
|
if command -v "pacman" >/dev/null 2>&1; then
|
|
|
|
alias pc='sudo pacman -Sc'
|
|
|
|
alias pi='sudo pacman -S --needed'
|
|
|
|
alias pqi='pacman -Qi'
|
|
|
|
alias pqo='pacman -Qo'
|
|
|
|
alias pqs='pacman -Qs'
|
|
|
|
alias pr='sudo pacman -Rs'
|
|
|
|
alias psi='pacman -Si'
|
|
|
|
alias pss='pacman -Ss'
|
|
|
|
alias pu='sudo pacman -Syu'
|
2013-03-03 00:01:20 +01:00
|
|
|
fi
|
2012-06-15 16:54:02 +02:00
|
|
|
|
2012-10-29 15:29:54 +01:00
|
|
|
##==============================================================================
|
|
|
|
## FreeBSD aliases
|
|
|
|
##==============================================================================
|
2013-03-03 00:01:20 +01:00
|
|
|
if [ "$(uname)" = "FreeBSD" ]; then
|
|
|
|
alias pa='sudo pkg_add -r'
|
|
|
|
# alias pd='sudo pkg_delete'
|
|
|
|
alias pd='sudo pkg_deinstall -cd'
|
|
|
|
alias pi='pkg_info -RrcdsD -l "::"'
|
|
|
|
alias pil='pkg_info -L'
|
|
|
|
|
|
|
|
## Origin of file
|
|
|
|
alias piw='pkg_info -W'
|
|
|
|
|
|
|
|
## Search
|
|
|
|
alias pis='pkg_info -Qox'
|
|
|
|
# alias pvs='pkg_version -Is'
|
|
|
|
alias psr='pkg_search -r'
|
|
|
|
|
|
|
|
## Out-of-date packages.
|
|
|
|
alias pv='pkg_version -Il "<"'
|
|
|
|
|
|
|
|
## Port tree
|
|
|
|
alias mi='sudo make install'
|
|
|
|
alias mid='sudo make install distclean'
|
|
|
|
alias mc='sudo make config'
|
|
|
|
fi
|
2012-07-30 12:59:20 +02:00
|
|
|
|
|
|
|
##==============================================================================
|
|
|
|
## TeXlive aliases
|
|
|
|
##==============================================================================
|
|
|
|
|
|
|
|
## TeXlive
|
|
|
|
if [ -d "/usr/local/texlive" ]; then
|
2012-11-01 18:08:44 +01:00
|
|
|
alias tlu="sudo sh -c 'umask 022 && tlmgr update --self'"
|
2012-09-01 15:32:47 +02:00
|
|
|
alias tls="tlmgr search --global"
|
2013-05-12 14:38:53 +02:00
|
|
|
alias tlsf="tlmgr search --global --file"
|
2013-01-08 19:57:12 +01:00
|
|
|
# alias tll="tlmgr info --only-installed"
|
|
|
|
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'"
|
|
|
|
|
|
|
|
|
2013-01-08 17:24:17 +01:00
|
|
|
alias tlf="tlmgr info --list"
|
2012-07-30 12:59:20 +02:00
|
|
|
fi
|