diff options
-rw-r--r-- | etc/aliases/suffix | 26 | ||||
-rw-r--r-- | etc/cleanup | 2 | ||||
-rw-r--r-- | etc/completion | 2 | ||||
-rw-r--r-- | etc/dircolors | 220 | ||||
-rw-r--r-- | etc/ls-colors | 8 | ||||
-rw-r--r-- | etc/mime-setup | 20 | ||||
-rw-r--r-- | etc/misc | 1 | ||||
-rw-r--r-- | etc/rc | 2 | ||||
-rwxr-xr-x | include/mimetypes | 21 |
9 files changed, 38 insertions, 264 deletions
diff --git a/etc/aliases/suffix b/etc/aliases/suffix index 9a2f1bc..c380156 100644 --- a/etc/aliases/suffix +++ b/etc/aliases/suffix @@ -1,26 +1,7 @@ ## 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 document emul image midi office raw video web) -# File extensions -archive_formats=(tar.bz2 tar.gz tar bz2 gz zip rar) -audio_formats=(aif aifc aiff amr amr au awb awb axa flac gsm kar m3u m3u m4a mid - midi mp2 mp3 mpega mpga oga ogg pls ra ra ram rm sd2 sid snd spx wav wax wma) -document_formats=(pdf ps) -emul_formats=(exe) -image_formats=(art bmp cdr cdt cpt djv djvu gif ico ief jng jpe jpeg jpg pat pbm - pcx pgm png pnm ppm psd ras rgb svg svgz tif tiff wbmp xbm xpm xwd) -midi_formats=(mid s3m) -office_formats=(doc odt ott rtf sxw) -raw_formats=(conf ini log txt htm html xhtml c cpp lst) -video_formats=(3gp asf asx avi axv dif dl dv fli flv gl lsf lsx mng mov movie mp4 - mpe mpeg mpg mpv mxu ogv qt wm wmv wmx wvx) -web_formats=(com de net org) - -# Applications archive_app='extr' audio_app='mplayer' document_app='kpdf' @@ -32,12 +13,11 @@ raw_app='vim' video_app='mplayer' web_app='x-www-browser' -# part 2: create the aliases -for meta in $filetypes; { - for format in $(eval echo -n "$"${meta}_formats); { +for meta in ${parameters[(I)mime_*]#mime_}; { + for format in $(eval echo "$"mime_$meta); { eval alias -s $format="$"${meta}_app } - unset ${meta}_{formats,app} + unset ${meta}_app } unset filetypes meta format diff --git a/etc/cleanup b/etc/cleanup index 834f6b0..a942392 100644 --- a/etc/cleanup +++ b/etc/cleanup @@ -6,4 +6,4 @@ unalias 'openbsd:' unfunction zrc_status zrc_info unfunction xexport xsource unset system distro -unset ps_fail ps_green ps_info ps_red ps_reset ps_yellow +unset -m 'mime_*' diff --git a/etc/completion b/etc/completion index a96412e..8700fe9 100644 --- a/etc/completion +++ b/etc/completion @@ -6,7 +6,7 @@ zstyle ':completion:*' cache-path $ZCACHEDIR zstyle ':completion:*' use-cache true # Use ls-colors for file completion -check_com -c dircolors && zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # Mark the current selection when tabbing through possible completions zstyle ':completion:*' menu select=1 diff --git a/etc/dircolors b/etc/dircolors deleted file mode 100644 index 8515ff0..0000000 --- a/etc/dircolors +++ /dev/null @@ -1,220 +0,0 @@ -# Configuration file for dircolors, a utility to help you set the -# LS_COLORS environment variable used by GNU ls with the --color option. -# Copyright (C) 1996, 1999-2008 -# Free Software Foundation, Inc. -# Copying and distribution of this file, with or without modification, -# are permitted provided the copyright notice and this notice are preserved. -# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the -# slackware version of dircolors) are recognized but ignored. -# Below, there should be one TERM entry for each termtype that is colorizable -TERM Eterm -TERM ansi -TERM color-xterm -TERM con132x25 -TERM con132x30 -TERM con132x43 -TERM con132x60 -TERM con80x25 -TERM con80x28 -TERM con80x30 -TERM con80x43 -TERM con80x50 -TERM con80x60 -TERM cons25 -TERM console -TERM cygwin -TERM dtterm -TERM eterm-color -TERM gnome -TERM gnome-256color -TERM konsole -TERM kterm -TERM linux -TERM linux-c -TERM mach-color -TERM mlterm -TERM putty -TERM rxvt -TERM rxvt-cygwin -TERM rxvt-cygwin-native -TERM rxvt-unicode -TERM screen -TERM screen-256color -TERM screen-bce -TERM screen-w -TERM screen.linux -TERM vt100 -TERM xterm -TERM xterm-16color -TERM xterm-256color -TERM xterm-88color -TERM xterm-color -TERM xterm-debian -# Below are the color init strings for the basic file types. A color init -# string consists of one or more of the following numeric codes: -# Attribute codes: -# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed -# Text color codes: -# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white -# Background color codes: -# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white -NORMAL 00 # global default, although everything should be something. -FILE 00 # normal file -DIR 01;37 # directory -LINK 01;36 # symbolic link. (If you set this to 'target' instead of a - # numerical value, the color is as for the file pointed to.) -FIFO 40;33 # pipe -SOCK 01;35 # socket -DOOR 01;35 # door -BLK 40;33;01 # block device driver -CHR 40;33;01 # character device driver -ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file -SETUID 37;41 # file that is setuid (u+s) -SETGID 30;43 # file that is setgid (g+s) -STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) -OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky -STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable -# This is for files with execute permission: -EXEC 01;32 -# List any file extensions like '.gz' or '.tar' that you would like ls -# to colorize below. Put the extension, a space, and the color init string. -# (and any comments you want to add after a '#') -# If you use DOS-style suffixes, you may want to uncomment the following: -#.cmd 01;32 # executables (bright green) -#.exe 01;32 -#.com 01;32 -#.btm 01;32 -#.bat 01;32 -# Or if you want to colorize scripts even if they do not have the -# executable bit actually set. -#.sh 01;32 -#.csh 01;32 - -## Extension based colors are indicated by an underline -# archives/compressed files (red) -.tar 04;31 -.tgz 04;31 -.svgz 04;31 -.arj 04;31 -.taz 04;31 -.lzh 04;31 -.lzma 04;31 -.zip 04;31 -.z 04;31 -.Z 04;31 -.dz 04;31 -.gz 04;31 -.bz2 04;31 -.bz 04;31 -.tbz2 04;31 -.tz 04;31 -.deb 04;31 -.rpm 04;31 -.jar 04;31 -.rar 04;31 -.ace 04;31 -.zoo 04;31 -.cpio 04;31 -.7z 04;31 -.rz 04;31 -# images (yellow) -.art 04;33 -.bmp 04;33 -.cdr 04;33 -.cdt 04;33 -.cpt 04;33 -.djv 04;33 -.djvu 04;33 -.gif 04;33 -.ico 04;33 -.ief 04;33 -.jng 04;33 -.jpe 04;33 -.jpeg 04;33 -.jpg 04;33 -.pat 04;33 -.pbm 04;33 -.pcx 04;33 -.pgm 04;33 -.png 04;33 -.pnm 04;33 -.ppm 04;33 -.psd 04;33 -.ras 04;33 -.rgb 04;33 -.svg 04;33 -.svgz 04;33 -.tif 04;33 -.tiff 04;33 -.wbmp 04;33 -.xbm 04;33 -.xpm 04;33 -.xwd 04;33 -# videos (green) -.3gp 04;32 -.asf 04;32 -.asx 04;32 -.avi 04;32 -.axv 04;32 -.dif 04;32 -.dl 04;32 -.dv 04;32 -.fli 04;32 -.flv 04;32 -.gl 04;32 -.lsf 04;32 -.lsx 04;32 -.mng 04;32 -.mov 04;32 -.movie 04;32 -.mp4 04;32 -.mpe 04;32 -.mpeg 04;32 -.mpg 04;32 -.mpv 04;32 -.mxu 04;32 -.ogv 04;32 -.qt 04;32 -.wm 04;32 -.wmv 04;32 -.wmx 04;32 -.wvx 04;32 -# audio (cyan) -.aif 04;36 -.aifc 04;36 -.aiff 04;36 -.amr 04;36 -.amr 04;36 -.au 04;36 -.awb 04;36 -.awb 04;36 -.axa 04;36 -.flac 04;36 -.gsm 04;36 -.kar 04;36 -.m3u 04;36 -.m3u 04;36 -.m4a 04;36 -.mid 04;36 -.midi 04;36 -.mp2 04;36 -.mp3 04;36 -.mpega 04;36 -.mpga 04;36 -.oga 04;36 -.ogg 04;36 -.pls 04;36 -.ra 04;36 -.ra 04;36 -.ram 04;36 -.rm 04;36 -.sd2 04;36 -.sid 04;36 -.snd 04;36 -.spx 04;36 -.wav 04;36 -.wax 04;36 -.wma 04;36 -# document formats, not plain text! (white) -.odt 04 -.pdf 04 diff --git a/etc/ls-colors b/etc/ls-colors new file mode 100644 index 0000000..3566aa6 --- /dev/null +++ b/etc/ls-colors @@ -0,0 +1,8 @@ +## vim:ft=zsh +LS_COLORS="no=00:fi=00:di=01;37:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32" + +LS_COLORS+=${(j/:/):-"*."${^mime_archive}"=04;31"} +LS_COLORS+=${(j/:/):-"*."${^mime_audio}"=04;36"} +LS_COLORS+=${(j/:/):-"*."${^mime_document}"=04"} +LS_COLORS+=${(j/:/):-"*."${^mime_image}"=04;33"} +LS_COLORS+=${(j/:/):-"*."${^mime_video}"=04;32"} diff --git a/etc/mime-setup b/etc/mime-setup new file mode 100644 index 0000000..85deeb7 --- /dev/null +++ b/etc/mime-setup @@ -0,0 +1,20 @@ +## vim:ft=zsh +## mime-setup - Initialize parameters used for suffix aliases and ls-colors + +mime_archive=( + 7z ace arj bz bz2 cpio deb dz gz jar lzh lzma rar rpm rz svgz + tar taz tbz2 tgz tz z Z zip zoo +) +mime_audio=( + aif aifc aiff amr amr au awb awb axa flac gsm kar m3u m3u m4a mid midi + mp2 mp3 mpega mpga oga ogg pls ra ra ram rm sd2 sid snd spx wav wax wma +) +mime_document=(pdf ps) +mime_image=( + art bmp cdr cdt cpt djv djvu gif ico ief jng jpe jpeg jpg pat pbm pcx + pgm png pnm ppm psd ras rgb svg svgz tif tiff wbmp xbm xpm xwd +) +mime_video=( + 3gp asf asx avi axv dif dl dv fli flv gl lsf lsx mng mov + movie mp4 mpe mpeg mpg mpv mxu ogv qt wm wmv wmx wvx +) @@ -1,6 +1,5 @@ ## vim:ft=zsh # misc -check_com -c dircolors && eval $(dircolors -b $ZDIR/dircolors) mesg n umask 077 chpwd @@ -10,6 +10,8 @@ source $ZDIR/osdetect source $ZDIR/rc_status source $ZDIR/options source $ZDIR/parameters +source $ZDIR/mime-setup +source $ZDIR/ls-colors source $ZDIR/function source $ZDIR/zle source $ZDIR/prompt diff --git a/include/mimetypes b/include/mimetypes index 5a7f92b..ad4eb79 100755 --- a/include/mimetypes +++ b/include/mimetypes @@ -12,21 +12,6 @@ audio=(${(i)audio}) video=(${(i)video}) image=(${(i)image}) -echo "## dircolors" -echo "# audio" -for type in $audio; { - echo ".$type $c_audio" -} -echo "\n# video" -for type in $video; { - echo ".$type $c_video" -} -echo "\n# images" -for type in $image; { - echo ".$type $c_image" -} - -echo "\n\n## suffix aliases" -echo "audio_formats=($audio)" -echo "video_formats=($video)" -echo "image_formats=($image)" +echo "mime_audio=($audio)" +echo "mime_video=($video)" +echo "mime_image=($image)" |