summaryrefslogtreecommitdiff
path: root/etc/aliases/suffix
blob: d86d8a4c1aafbcb247471b96ce174562251a8c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Sufix aliases
## Like, enter "somefile.ogg" and zsh will automatically open it using $audio_app
## vim:ft=zsh
# part 1: what filetypes to open whith what app?
# List of filetypes covered by aliases
filetypes=(archive audio midi video image document raw office emul web)

# File extensions
archive_formats=(tar.bz2 tar.gz tar bz2 gz zip rar)
audio_formats=(flac mp3 ogg wav wma)
midi_formats=(mid s3m)
video_formats=(avi divx flv m4v mkv mp4 mpg mpeg ogm wmv)
image_formats=(bmp jpg jpeg gif png)
document_formats=(pdf ps)
raw_formats=(conf ini log txt htm html xhtml c cpp lst)
office_formats=(doc odt ott rtf sxw)
emul_formats=(exe)
web_formats=(com de net org)

# Applications
archive_app='extr'
audio_app='mplayer'
video_app='mplayer'
midi_app='timidity'
image_app='feh'
document_app='kpdf'
raw_app='vim'
office_app='openoffice'
emul_app='wine'
web_app='x-www-browser'

# part 2: create the aliases
for meta in $filetypes; {
	for format in $(eval echo -n "$"${meta}_formats); {
		eval alias -s $format="$"${meta}_app
	}
	unset ${meta}_{formats,app}
}

unset filetypes meta format