Suffix Aliases

Since zsh 4.2.x its possible to make a programme alias for a given filename extension.
That means, you can assign commands to filename suffixes.

alias -s txt='less -rE'

Now every time you enter a $filename with extension .txt less -rE $filename is invoked.
If you use `*.txt' then all files with that extension will be invoked with the command less with options -r -E.

Note: These Aliases are from a desktop System

# archives
alias -s zip="zipinfo"
alias -s gz="file-roller"  # because its not possible to make an alias on tar.gz its better to make a general alias for all gz-files 
# gfx
alias -s xcf="gimp-remote"
alias -s png="xv"
alias -s gif="xv"
alias -s jpg="xv"
# media files
alias -s pdf="acroread"
# code
alias -s php="/usr/share/vim/vim62/macros/less.sh" # less with vim's syntax-hilighting
alias -s c="/usr/share/vim/vim62/macros/less.sh"
alias -s html="/usr/share/vim/vim62/macros/less.sh"
 
examples/aliassuffix.txt · Last modified: 2010/01/05 09:20 (external edit)