From 2ca2876be5418a5e9d864f53716149b0fd3a09f1 Mon Sep 17 00:00:00 2001 From: Armin Date: Sat, 28 Feb 2015 17:27:28 +0100 Subject: [PATCH 1/5] dircolors: add new dircolors file / zshrc: added FreeBSD compatibility --- dircolors | 202 ++++++++++++++++++++++++++++++++++++++++++++---------- zshrc | 41 +++++------ 2 files changed, 187 insertions(+), 56 deletions(-) diff --git a/dircolors b/dircolors index 09131f61b..af9677676 100644 --- a/dircolors +++ b/dircolors @@ -1,11 +1,16 @@ -# Configuration file for dircolors, a utility to help you set the +# Configuration file for dircolors, a utility to help you set the -*- sh -*- # LS_COLORS environment variable used by GNU ls with the --color option. -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# 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 + +# to test changes to this file, use the following command in a fresh terminal: +# while true; do eval "$(dircolors "$ZSH"/dircolors)"; ls; sleep 0.5; clear; done + TERM Eterm TERM ansi TERM color-xterm @@ -26,35 +31,23 @@ TERM dtterm TERM eterm-color TERM gnome TERM gnome-256color -TERM hurd TERM jfbterm TERM konsole TERM kterm TERM linux TERM linux-c TERM mach-color -TERM mach-gnu-color TERM mlterm TERM putty -TERM putty-256color TERM rxvt -TERM rxvt-256color TERM rxvt-cygwin TERM rxvt-cygwin-native TERM rxvt-unicode -TERM rxvt-unicode-256color -TERM rxvt-unicode256 TERM screen TERM screen-256color -TERM screen-256color-bce TERM screen-bce TERM screen-w -TERM screen.Eterm -TERM screen.rxvt TERM screen.linux -TERM st -TERM st-256color -TERM terminator TERM vt100 TERM xterm TERM xterm-16color @@ -76,7 +69,7 @@ RESET 0 # reset to "normal" color DIR 01;34 # 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.) -MULTIHARDLINK 00 # regular file with more than one link +################### HARDLINK 44;37 # regular file with more than one link FIFO 40;33 # pipe SOCK 01;35 # socket DOOR 01;35 # door @@ -91,6 +84,9 @@ 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 + +* 00;38;5;253 + # 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 '#') @@ -107,45 +103,28 @@ EXEC 01;32 # archives or compressed (bright red) .tar 01;31 .tgz 01;31 -.arc 01;31 .arj 01;31 .taz 01;31 -.lha 01;31 -.lz4 01;31 .lzh 01;31 .lzma 01;31 -.tlz 01;31 -.txz 01;31 -.tzo 01;31 -.t7z 01;31 .zip 01;31 .z 01;31 .Z 01;31 .dz 01;31 .gz 01;31 -.lrz 01;31 -.lz 01;31 -.lzo 01;31 -.xz 01;31 .bz2 01;31 .bz 01;31 -.tbz 01;31 .tbz2 01;31 .tz 01;31 .deb 01;31 .rpm 01;31 .jar 01;31 -.war 01;31 -.ear 01;31 -.sar 01;31 .rar 01;31 -.alz 01;31 .ace 01;31 .zoo 01;31 .cpio 01;31 .7z 01;31 .rz 01;31 -.cab 01;31 # image formats .jpg 01;35 .jpeg 01;35 @@ -169,7 +148,6 @@ EXEC 01;32 .mpeg 01;35 .m2v 01;35 .mkv 01;35 -.webm 01;35 .ogm 01;35 .mp4 01;35 .m4v 01;35 @@ -190,8 +168,6 @@ EXEC 01;32 .xcf 01;35 .xwd 01;35 .yuv 01;35 -.cgm 01;35 -.emf 01;35 # http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions .axv 01;35 .anx 01;35 @@ -201,7 +177,6 @@ EXEC 01;32 .aac 00;36 .au 00;36 .flac 00;36 -.m4a 00;36 .mid 00;36 .midi 00;36 .mka 00;36 @@ -215,3 +190,158 @@ EXEC 01;32 .oga 00;36 .spx 00;36 .xspf 00;36 +################# BEGIN USER CUSTOMIZATION +# +# 00;38;5;x (x = 1-88) more colours (urxvt) +# 00;38;3;x (no colour but italic text) +# 00;38;4;x (no colour but underlined text) +# 00;38;6;x (no colour but blinking text) +# 00;38;7;x (no colour but reverse text) +# +#* 00;38;5;78 +.foo 00;38;5;72 +.dump 00;38;5;84 +################## VIDEO FORMATS +.mov 00;38;5;70 +.mpg 00;38;5;70 +.mpeg 00;38;5;70 +.mkv 00;38;5;70 +.ogm 00;38;5;70 +.qt 00;38;5;70 +.avi 00;38;5;70 +.ogv 00;38;5;70 +.divx 00;38;5;70 +.xvid 00;38;5;70 +################## ATYPICAL VIDEO FORMATS +.flv 00;38;5;70 +.mp4 00;38;5;70 +.wmv 00;38;5;70 +.asf 00;38;5;70 +.rm 00;38;5;70 +.rmvb 00;38;5;70 +.flc 00;38;5;70 +.fli 00;38;5;70 +.m2v 00;38;5;70 +.m4v 00;38;5;70 +.mp4v 00;38;5;70 +.nuv 00;38;5;70 +################## DVD FILES +.vob 00;38;5;55 +.VOB 00;38;5;55 +.IFO 00;38;5;53 +.ifo 00;38;5;53 +.BUP 00;38;5;53 +.bup 00;38;5;53 +################## AUDIO FORMATS +.ogg 00;38;5;32 +.oga 00;38;5;32 +.mp3 00;38;5;32 +.mid 00;38;5;43 +.midi 00;38;5;43 +.MID 00;38;5;43 +.aac 00;38;5;32 +.au 00;38;5;32 +.flac 00;38;5;32 +.mka 00;38;5;32 +.mpc 00;38;5;32 +.ra 00;38;5;32 +.m4a 00;38;5;32 +.wav 00;38;5;32 +################# PLAYLIST FORMATS +.m3u 00;38;5;37 +.pls 00;38;5;37 +.lst 00;38;5;37 +################# DOCUMENT FORMATS +.pdf 00;38;5;78 +.txt 00;38;5;86 +*EADME 01;38;5;76 +*EADME.txt 01;38;5;76 +*eadme 01;38;5;76 +*eadme.txt 01;38;5;76 +.log 00;38;5;86 +.tex 00;38;5;74 +################# CONFIG FILES +*rc 00;38;5;72 +.bash_aliases 00;38;5;72 +.bash_functions 00;38;5;72 +.bashrc 00;38;5;72 +.bash_profile 00;38;5;72 +.bash_prompt 00;38;5;72 +.bash_history 00;38;5;79 +.profile 00;38;5;72 +.conf 00;38;5;72 +.config 00;38;5;72 +.gitconfig 00;38;5;72 +.cfg 00;38;5;72 +.ini 00;38;5;72 +.cache 00;38;5;72 +.dpkg-dist 00;38;5;68 +.dpkg-new 00;38;5;68 +.dpkg-old 00;38;5;68 +*~ 00;38;5;77 +################# Runnable +.sh 00;38;5;60 +.run 00;38;5;60 +.bin 00;38;5;60 +.py 00;38;5;60 +.pl 00;38;5;60 +################# IMAGE FORMATS +.png 00;38;5;103 +.jpg 00;38;5;103 +.jpeg 00;38;5;103 +.gif 00;38;5;103 +.bmp 00;38;5;103 +.pbm 00;38;5;103 +.pgm 00;38;5;103 +.ppm 00;38;5;103 +.tga 00;38;5;103 +.xbm 00;38;5;103 +.xpm 00;38;5;103 +.tif 00;38;5;103 +.tiff 00;38;5;103 +.svg 00;38;5;103 +.svgz 00;38;5;103 +.mng 00;38;5;103 +.pcx 00;38;5;103 +.xar 00;38;5;103 +################# COMPRESSED FILES AND ARCHIVES +.deb 00;38;5;65 +.rpm 00;38;5;65 +.tar 00;38;5;136 +.tgz 00;38;5;136 +.gz 00;38;5;136 +.bz2 00;38;5;136 +.bz 00;38;5;136 +.tbz2 00;38;5;136 +.zip 00;38;5;136 +.rar 00;38;5;136 +.7z 00;38;5;136 +.arj 00;38;5;136 +.taz 00;38;5;136 +.lzh 00;38;5;136 +.lzma 00;38;5;136 +.z 00;38;5;136 +.Z 00;38;5;136 +.dz 00;38;5;136 +.tz 00;38;5;136 +.jar 00;38;5;136 +.ace 00;38;5;136 +.zoo 00;38;5;136 +.cpio 00;38;5;136 +.rz 00;38;5;136 + +# Image / Package Files +.dmg 00;38;5;139 +.img 00;38;5;143 +.pkg 00;38;5;143 + +# Fonts +.ttf 00;38;5;149 + +# GPG +.asc 00;38;5;153 + +# Mac Finder Files +.DS_Store 00;38;5;146 +.localized 00;38;5;146 + diff --git a/zshrc b/zshrc index a28742041..815e84f80 100644 --- a/zshrc +++ b/zshrc @@ -112,42 +112,41 @@ if [[ "$OS_TYPE" == "Darwin" ]]; then export HOMEBREW_VERBOSE=1 export HOMEBREW_CURL_VERBOSE=1 export HOMEBREW_NO_EMOJI=1 - # let's use ls from gnu utils because the bsd ls doesn't know long options: - if hash gls; then + if hash gls >/dev/null 2>&1; then LS_COMMAND="gls" else LS_COMMAND="ls" fi - # homebrew verbose and without annoying emoji icon: export HOMEBREW_VERBOSE=1 export HOMEBREW_CURL_VERBOSE=1 export HOMEBREW_NO_EMOJI=1 - # let's use dircolors from gnu utils because the osx version is buggy: - alias dircolors="gdircolors" -# Linux specific stuff + if hash gdircolors >/dev/null 2>&1; then + alias dircolors="gdircolors" + dircolors_enable=1 + fi + if hash gls >/dev/null 2>&1; then + alias ls='gls $LS_OPTIONS' + fi else LS_COMMAND="ls" fi if [[ "$OS_TYPE" == "FreeBSD" ]]; then + alias ls='ls -al -F' CLICOLOR=1; export CLICOLOR - alias installport="sudo make config-recursive install clean clean-depends" - if [[ ! -e /usr/local/bin/gls ]]; then - echo "You should install the \"coreutils\" FreeBSD port." - else - alias ls='gls $LS_OPTIONS' - fi - if [[ ! -e /usr/local/bin/gdircolors ]]; then - echo "You should install the \"coreutils\" FreeBSD port." - else - alias dircolors='/usr/local/bin/gdircolors' + alias portinstall="sudo make config-recursive install clean clean-depends" + if hash gdircolors >/dev/null 2>&1; then + alias dircolors="$(which gdircolors)" + dircolors_enable=1 fi fi # enable ls colorization: if [ "$TERM" != "dumb" ]; then - eval "$(dircolors "$ZSH"/dircolors)" - alias ls="$LS_COMMAND $LS_OPTIONS" + if [[ "$dircolors_enable" == 1 ]]; then + eval "$(dircolors "$ZSH"/dircolors)" + alias ls="$LS_COMMAND $LS_OPTIONS" + fi fi # set $SHELL: @@ -176,8 +175,10 @@ alias grep='grep --color=auto' # enable ls colorization: if [ "$TERM" != "dumb" ]; then - eval "$(dircolors "$ZSH"/dircolors)" - alias ls="$LS_COMMAND $LS_OPTIONS" + if [[ "$dircolors_enable" == 1 ]]; then + eval "$(dircolors "$ZSH"/dircolors)" + alias ls="$LS_COMMAND $LS_OPTIONS" + fi fi # do not autocorrect sudo commands (fixes "zsh: correct 'vim' to '.vim' [nyae]?") From 1c8d73147d135a6e53e711d0e46b6c0724ebba45 Mon Sep 17 00:00:00 2001 From: Armin Date: Sat, 28 Feb 2015 23:31:20 +0100 Subject: [PATCH 2/5] bugfix --- zshrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index 815e84f80..fc615900c 100644 --- a/zshrc +++ b/zshrc @@ -132,7 +132,10 @@ else fi if [[ "$OS_TYPE" == "FreeBSD" ]]; then - alias ls='ls -al -F' + if hash gls >/dev/null 2>&1; then + alias ls='gls -al -F' + LS_COMMAND=gls + fi CLICOLOR=1; export CLICOLOR alias portinstall="sudo make config-recursive install clean clean-depends" if hash gdircolors >/dev/null 2>&1; then From c54bf176b8a5489f71eb3954dcd39cf6598cdd5a Mon Sep 17 00:00:00 2001 From: Armin Date: Sun, 8 Mar 2015 15:07:39 +0100 Subject: [PATCH 3/5] add -F for ls --- lib/theme-and-appearance.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index bbd0dae9c..523315084 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -6,7 +6,7 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [ "$DISABLE_LS_COLORS" != "true" ] then # Find the option for using colors in ls, depending on the version: Linux or BSD - ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' + ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty -F' || alias ls='ls -G' fi #setopt no_beep From 557a54c0cc2a7e4e15af805ba72edc698cb61fde Mon Sep 17 00:00:00 2001 From: Armin Date: Fri, 13 Mar 2015 19:51:09 +0100 Subject: [PATCH 4/5] add powerline colours for reality --- lib/powerline/reality | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 lib/powerline/reality diff --git a/lib/powerline/reality b/lib/powerline/reality new file mode 100644 index 000000000..a25dbc38f --- /dev/null +++ b/lib/powerline/reality @@ -0,0 +1,6 @@ +colours=(252 126 152 32) +prompt_context_user_fg="${colours[1]}" +prompt_context_user_bg="${colours[2]}" +prompt_context_root_fg="${colours[3]}" +prompt_context_root_bg="${colours[4]}" + From f1cb33fb171b1afe2726f1f628ab09bb0535535f Mon Sep 17 00:00:00 2001 From: Armin Date: Fri, 13 Mar 2015 19:51:27 +0100 Subject: [PATCH 5/5] add powerline colours for nagios host --- lib/powerline/nagios | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 lib/powerline/nagios diff --git a/lib/powerline/nagios b/lib/powerline/nagios new file mode 100644 index 000000000..ee6ff7bb8 --- /dev/null +++ b/lib/powerline/nagios @@ -0,0 +1,6 @@ +colours=(252 29 152 32) +prompt_context_user_fg="${colours[1]}" +prompt_context_user_bg="${colours[2]}" +prompt_context_root_fg="${colours[3]}" +prompt_context_root_bg="${colours[4]}" +