mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Merge branch 'master' of https://github.com/netzverweigerer/oh-my-zsh
This commit is contained in:
commit
6f4a3ea6dc
5 changed files with 272 additions and 246 deletions
202
dircolors
202
dircolors
|
|
@ -1,16 +1,11 @@
|
||||||
# Configuration file for dircolors, a utility to help you set the -*- sh -*-
|
# Configuration file for dircolors, a utility to help you set the
|
||||||
# LS_COLORS environment variable used by GNU ls with the --color option.
|
# LS_COLORS environment variable used by GNU ls with the --color option.
|
||||||
# Copyright (C) 1996, 1999-2008
|
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# Copying and distribution of this file, with or without modification,
|
# Copying and distribution of this file, with or without modification,
|
||||||
# are permitted provided the copyright notice and this notice are preserved.
|
# are permitted provided the copyright notice and this notice are preserved.
|
||||||
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
|
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
|
||||||
# slackware version of dircolors) are recognized but ignored.
|
# slackware version of dircolors) are recognized but ignored.
|
||||||
# Below, there should be one TERM entry for each termtype that is colorizable
|
# 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 Eterm
|
||||||
TERM ansi
|
TERM ansi
|
||||||
TERM color-xterm
|
TERM color-xterm
|
||||||
|
|
@ -31,23 +26,35 @@ TERM dtterm
|
||||||
TERM eterm-color
|
TERM eterm-color
|
||||||
TERM gnome
|
TERM gnome
|
||||||
TERM gnome-256color
|
TERM gnome-256color
|
||||||
|
TERM hurd
|
||||||
TERM jfbterm
|
TERM jfbterm
|
||||||
TERM konsole
|
TERM konsole
|
||||||
TERM kterm
|
TERM kterm
|
||||||
TERM linux
|
TERM linux
|
||||||
TERM linux-c
|
TERM linux-c
|
||||||
TERM mach-color
|
TERM mach-color
|
||||||
|
TERM mach-gnu-color
|
||||||
TERM mlterm
|
TERM mlterm
|
||||||
TERM putty
|
TERM putty
|
||||||
|
TERM putty-256color
|
||||||
TERM rxvt
|
TERM rxvt
|
||||||
|
TERM rxvt-256color
|
||||||
TERM rxvt-cygwin
|
TERM rxvt-cygwin
|
||||||
TERM rxvt-cygwin-native
|
TERM rxvt-cygwin-native
|
||||||
TERM rxvt-unicode
|
TERM rxvt-unicode
|
||||||
|
TERM rxvt-unicode-256color
|
||||||
|
TERM rxvt-unicode256
|
||||||
TERM screen
|
TERM screen
|
||||||
TERM screen-256color
|
TERM screen-256color
|
||||||
|
TERM screen-256color-bce
|
||||||
TERM screen-bce
|
TERM screen-bce
|
||||||
TERM screen-w
|
TERM screen-w
|
||||||
|
TERM screen.Eterm
|
||||||
|
TERM screen.rxvt
|
||||||
TERM screen.linux
|
TERM screen.linux
|
||||||
|
TERM st
|
||||||
|
TERM st-256color
|
||||||
|
TERM terminator
|
||||||
TERM vt100
|
TERM vt100
|
||||||
TERM xterm
|
TERM xterm
|
||||||
TERM xterm-16color
|
TERM xterm-16color
|
||||||
|
|
@ -69,7 +76,7 @@ RESET 0 # reset to "normal" color
|
||||||
DIR 01;34 # directory
|
DIR 01;34 # directory
|
||||||
LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
|
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.)
|
# numerical value, the color is as for the file pointed to.)
|
||||||
################### HARDLINK 44;37 # regular file with more than one link
|
MULTIHARDLINK 00 # regular file with more than one link
|
||||||
FIFO 40;33 # pipe
|
FIFO 40;33 # pipe
|
||||||
SOCK 01;35 # socket
|
SOCK 01;35 # socket
|
||||||
DOOR 01;35 # door
|
DOOR 01;35 # door
|
||||||
|
|
@ -84,9 +91,6 @@ 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
|
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
|
||||||
# This is for files with execute permission:
|
# This is for files with execute permission:
|
||||||
EXEC 01;32
|
EXEC 01;32
|
||||||
|
|
||||||
* 00;38;5;253
|
|
||||||
|
|
||||||
# List any file extensions like '.gz' or '.tar' that you would like ls
|
# 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.
|
# to colorize below. Put the extension, a space, and the color init string.
|
||||||
# (and any comments you want to add after a '#')
|
# (and any comments you want to add after a '#')
|
||||||
|
|
@ -103,28 +107,45 @@ EXEC 01;32
|
||||||
# archives or compressed (bright red)
|
# archives or compressed (bright red)
|
||||||
.tar 01;31
|
.tar 01;31
|
||||||
.tgz 01;31
|
.tgz 01;31
|
||||||
|
.arc 01;31
|
||||||
.arj 01;31
|
.arj 01;31
|
||||||
.taz 01;31
|
.taz 01;31
|
||||||
|
.lha 01;31
|
||||||
|
.lz4 01;31
|
||||||
.lzh 01;31
|
.lzh 01;31
|
||||||
.lzma 01;31
|
.lzma 01;31
|
||||||
|
.tlz 01;31
|
||||||
|
.txz 01;31
|
||||||
|
.tzo 01;31
|
||||||
|
.t7z 01;31
|
||||||
.zip 01;31
|
.zip 01;31
|
||||||
.z 01;31
|
.z 01;31
|
||||||
.Z 01;31
|
.Z 01;31
|
||||||
.dz 01;31
|
.dz 01;31
|
||||||
.gz 01;31
|
.gz 01;31
|
||||||
|
.lrz 01;31
|
||||||
|
.lz 01;31
|
||||||
|
.lzo 01;31
|
||||||
|
.xz 01;31
|
||||||
.bz2 01;31
|
.bz2 01;31
|
||||||
.bz 01;31
|
.bz 01;31
|
||||||
|
.tbz 01;31
|
||||||
.tbz2 01;31
|
.tbz2 01;31
|
||||||
.tz 01;31
|
.tz 01;31
|
||||||
.deb 01;31
|
.deb 01;31
|
||||||
.rpm 01;31
|
.rpm 01;31
|
||||||
.jar 01;31
|
.jar 01;31
|
||||||
|
.war 01;31
|
||||||
|
.ear 01;31
|
||||||
|
.sar 01;31
|
||||||
.rar 01;31
|
.rar 01;31
|
||||||
|
.alz 01;31
|
||||||
.ace 01;31
|
.ace 01;31
|
||||||
.zoo 01;31
|
.zoo 01;31
|
||||||
.cpio 01;31
|
.cpio 01;31
|
||||||
.7z 01;31
|
.7z 01;31
|
||||||
.rz 01;31
|
.rz 01;31
|
||||||
|
.cab 01;31
|
||||||
# image formats
|
# image formats
|
||||||
.jpg 01;35
|
.jpg 01;35
|
||||||
.jpeg 01;35
|
.jpeg 01;35
|
||||||
|
|
@ -148,6 +169,7 @@ EXEC 01;32
|
||||||
.mpeg 01;35
|
.mpeg 01;35
|
||||||
.m2v 01;35
|
.m2v 01;35
|
||||||
.mkv 01;35
|
.mkv 01;35
|
||||||
|
.webm 01;35
|
||||||
.ogm 01;35
|
.ogm 01;35
|
||||||
.mp4 01;35
|
.mp4 01;35
|
||||||
.m4v 01;35
|
.m4v 01;35
|
||||||
|
|
@ -168,6 +190,8 @@ EXEC 01;32
|
||||||
.xcf 01;35
|
.xcf 01;35
|
||||||
.xwd 01;35
|
.xwd 01;35
|
||||||
.yuv 01;35
|
.yuv 01;35
|
||||||
|
.cgm 01;35
|
||||||
|
.emf 01;35
|
||||||
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
|
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
|
||||||
.axv 01;35
|
.axv 01;35
|
||||||
.anx 01;35
|
.anx 01;35
|
||||||
|
|
@ -177,6 +201,7 @@ EXEC 01;32
|
||||||
.aac 00;36
|
.aac 00;36
|
||||||
.au 00;36
|
.au 00;36
|
||||||
.flac 00;36
|
.flac 00;36
|
||||||
|
.m4a 00;36
|
||||||
.mid 00;36
|
.mid 00;36
|
||||||
.midi 00;36
|
.midi 00;36
|
||||||
.mka 00;36
|
.mka 00;36
|
||||||
|
|
@ -190,158 +215,3 @@ EXEC 01;32
|
||||||
.oga 00;36
|
.oga 00;36
|
||||||
.spx 00;36
|
.spx 00;36
|
||||||
.xspf 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
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ zstyle ':completion:*:hosts' hosts $hosts
|
||||||
|
|
||||||
# Use caching so that commands like apt and dpkg complete are useable
|
# Use caching so that commands like apt and dpkg complete are useable
|
||||||
zstyle ':completion::complete:*' use-cache 1
|
zstyle ':completion::complete:*' use-cache 1
|
||||||
zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
|
zstyle ':completion::complete:*' cache-path ~/.zsh/cache/
|
||||||
|
|
||||||
# Don't complete uninteresting users
|
# Don't complete uninteresting users
|
||||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||||
|
|
@ -66,3 +66,5 @@ if [ "$DISABLE_COMPLETION_WAITING_DOTS" != "true" ]; then
|
||||||
zle -N expand-or-complete-with-dots
|
zle -N expand-or-complete-with-dots
|
||||||
bindkey "^I" expand-or-complete-with-dots
|
bindkey "^I" expand-or-complete-with-dots
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,72 +1,4 @@
|
||||||
# custom colour definitions for powerline theme (oh-my-zsh)
|
colours=(22 71 152 32)
|
||||||
# this file should be symlinked to ~/.powerlinecolours if you
|
|
||||||
# want to make use of it.
|
|
||||||
|
|
||||||
# get your hostname checksum with:
|
|
||||||
|
|
||||||
# OSX:
|
|
||||||
# echo -n "$(hostname)" | shasum | cut -d" " -f 1
|
|
||||||
|
|
||||||
# Linux:
|
|
||||||
# echo -n "$(hostname)" | sha1sum | cut -d" " -f 1
|
|
||||||
|
|
||||||
# c7d8a6d722a1ec9a16fae165177c418d4fd63175
|
|
||||||
|
|
||||||
# use shasum on Mac OS X, sha1sum on Linux:
|
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
|
||||||
shasum_cmd="shasum"
|
|
||||||
else
|
|
||||||
shasum_cmd="sha1sum"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# calculate hostname sha1
|
|
||||||
hash="$(echo -n "$(hostname)" | $shasum_cmd | cut -d" " -f 1)"
|
|
||||||
|
|
||||||
case "$hash" in
|
|
||||||
|
|
||||||
|
|
||||||
# specify colour themes for different hosts here (to see the ccolour codes, use the 256-colour-test.py script):
|
|
||||||
c4c948228b9947cec128662a414e1f4194573329)
|
|
||||||
colours=(254 24 208 236)
|
|
||||||
# \ \ \ \________________> prompt background colour for root
|
|
||||||
# \ \ \__________________> prompt foreground colour for root
|
|
||||||
# \ \_____________________> prompt background colour for user
|
|
||||||
# \_______________________> prompt foreground colour for user
|
|
||||||
;;
|
|
||||||
|
|
||||||
c7d8a6d722a1ec9a16fae165177c418d4fd63175)
|
|
||||||
colours=(253 68 196 32)
|
|
||||||
# \ \ \ \________________> prompt background colour for root
|
|
||||||
# \ \ \__________________> prompt foreground colour for root
|
|
||||||
# \ \_____________________> prompt background colour for user
|
|
||||||
# \_______________________> prompt foreground colour for user
|
|
||||||
;;
|
|
||||||
|
|
||||||
09407639790bbb3778e1c2a9f81c0680186097d1)
|
|
||||||
colours=(254 62 196 32)
|
|
||||||
# \ \ \ \________________> prompt background colour for root
|
|
||||||
# \ \ \__________________> prompt foreground colour for root
|
|
||||||
# \ \_____________________> prompt background colour for user
|
|
||||||
# \_______________________> prompt foreground colour for user
|
|
||||||
;;
|
|
||||||
|
|
||||||
0ccd98ec02bedc50fef38fc9f285eb14b63c89a4)
|
|
||||||
colours=(254 130 196 32)
|
|
||||||
# \ \ \ \________________> prompt background colour for root
|
|
||||||
# \ \ \__________________> prompt foreground colour for root
|
|
||||||
# \ \_____________________> prompt background colour for user
|
|
||||||
# \_______________________> prompt foreground colour for user
|
|
||||||
;;
|
|
||||||
|
|
||||||
434b0a6daa530638a964132e86b8a01d7b39aa7c)
|
|
||||||
colours=(254 130 196 32)
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
# set colours from array:
|
# set colours from array:
|
||||||
prompt_context_user_fg="${colours[1]}"
|
prompt_context_user_fg="${colours[1]}"
|
||||||
|
|
|
||||||
207
themes/powerline-with-hostname.zsh-theme
Normal file
207
themes/powerline-with-hostname.zsh-theme
Normal file
|
|
@ -0,0 +1,207 @@
|
||||||
|
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||||
|
#
|
||||||
|
# powerline theme - based on agnoster's theme - https://gist.github.com/3712874
|
||||||
|
#
|
||||||
|
# I was not satisfied with the agnoster colours so I created my own powerline zsh theme based on the powerline bash
|
||||||
|
# colour codes.
|
||||||
|
# --- Armin <netzverweigerer@github>
|
||||||
|
#
|
||||||
|
# In order for this theme to render correctly, you will need a
|
||||||
|
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
|
||||||
|
#
|
||||||
|
|
||||||
|
### Segment drawing
|
||||||
|
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
||||||
|
|
||||||
|
CURRENT_BG='NONE'
|
||||||
|
SEGMENT_SEPARATOR=''
|
||||||
|
RSEGMENT_SEPARATOR=''
|
||||||
|
|
||||||
|
# use custom colours:
|
||||||
|
source "$ZSH"/lib/powerlinecolours
|
||||||
|
|
||||||
|
# Begin left side segment
|
||||||
|
# Takes two arguments, background and foreground. Both can be omitted,
|
||||||
|
# rendering default background/foreground.
|
||||||
|
prompt_segment() {
|
||||||
|
local bg fg
|
||||||
|
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
|
||||||
|
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
|
||||||
|
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
|
||||||
|
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
|
||||||
|
else
|
||||||
|
echo -n "%{$bg%}%{$fg%} "
|
||||||
|
fi
|
||||||
|
CURRENT_BG=$1
|
||||||
|
[[ -n $3 ]] && echo -n $3
|
||||||
|
}
|
||||||
|
|
||||||
|
# Begin right side segment
|
||||||
|
# Takes two arguments, background and foreground. Both can be omitted,
|
||||||
|
# rendering default background/foreground.
|
||||||
|
prompt_rsegment() {
|
||||||
|
local bg fg
|
||||||
|
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
|
||||||
|
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
|
||||||
|
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
|
||||||
|
echo -n " %{$bg%F{$CURRENT_BG}%}$RSEGMENT_SEPARATOR%{$fg%} "
|
||||||
|
else
|
||||||
|
echo -n "%{$bg%}%{$fg%} "
|
||||||
|
fi
|
||||||
|
CURRENT_BG=$1
|
||||||
|
[[ -n $3 ]] && echo -n $3
|
||||||
|
}
|
||||||
|
|
||||||
|
# right side seperator
|
||||||
|
prompt_rseperator() {
|
||||||
|
local bg fg
|
||||||
|
### [[ -n $1 ]] && bg="%K{$1}" || bg="%k"
|
||||||
|
bg="%k"
|
||||||
|
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
|
||||||
|
echo -n "%{$bg%}%{$fg%}$RSEGMENT_SEPARATOR"
|
||||||
|
[[ -n $3 ]] && echo -n $3
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# End the prompt, closing any open segments
|
||||||
|
prompt_end() {
|
||||||
|
if [[ -n $CURRENT_BG ]]; then
|
||||||
|
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
|
||||||
|
else
|
||||||
|
echo -n "%{%k%}"
|
||||||
|
fi
|
||||||
|
echo -n "%{%f%}"
|
||||||
|
CURRENT_BG=''
|
||||||
|
}
|
||||||
|
|
||||||
|
### Prompt components
|
||||||
|
# Each component will draw itself, and hide itself if no information needs to be shown
|
||||||
|
# TODO: check if $SSH_CLIENT is set and adjust prompt to include hostname of machine
|
||||||
|
# Context: user@hostname (who am I and where am I)
|
||||||
|
prompt_context() {
|
||||||
|
local user="$(whoami)"
|
||||||
|
local machine="$(hostname -s)"
|
||||||
|
if [[ "$user" == "root" ]]; then
|
||||||
|
# prompt for root
|
||||||
|
prompt_segment "$prompt_context_root_bg" "$prompt_context_root_fg" "%(!.%{%F{red}%}.)$user∆$machine"
|
||||||
|
else
|
||||||
|
# prompt for normal user
|
||||||
|
prompt_segment "$prompt_context_user_bg" "$prompt_context_user_fg" "%(!.%{%F{yellow}%}.)$user∆$machine"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Git: branch/detached head, dirty status
|
||||||
|
prompt_git() {
|
||||||
|
local ref dirty mode repo_path
|
||||||
|
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||||
|
|
||||||
|
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||||
|
dirty=$(parse_git_dirty)
|
||||||
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
|
||||||
|
if [[ -n $dirty ]]; then
|
||||||
|
prompt_segment yellow black
|
||||||
|
else
|
||||||
|
prompt_segment green black
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
|
||||||
|
mode=" <B>"
|
||||||
|
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
|
||||||
|
mode=" >M<"
|
||||||
|
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
|
||||||
|
mode=" >R>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
setopt promptsubst
|
||||||
|
autoload -Uz vcs_info
|
||||||
|
|
||||||
|
zstyle ':vcs_info:*' enable git
|
||||||
|
zstyle ':vcs_info:*' get-revision true
|
||||||
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
|
zstyle ':vcs_info:*' stagedstr '✚'
|
||||||
|
zstyle ':vcs_info:git:*' unstagedstr '●'
|
||||||
|
zstyle ':vcs_info:*' formats ' %u%c'
|
||||||
|
zstyle ':vcs_info:*' actionformats ' %u%c'
|
||||||
|
vcs_info
|
||||||
|
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_%% }${mode}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_hg() {
|
||||||
|
local rev status
|
||||||
|
if $(hg id >/dev/null 2>&1); then
|
||||||
|
if $(hg prompt >/dev/null 2>&1); then
|
||||||
|
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||||
|
# if files are not added
|
||||||
|
prompt_segment red white
|
||||||
|
st='±'
|
||||||
|
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||||
|
# if any modification
|
||||||
|
prompt_segment yellow black
|
||||||
|
st='±'
|
||||||
|
else
|
||||||
|
# if working copy is clean
|
||||||
|
prompt_segment green black
|
||||||
|
fi
|
||||||
|
echo -n $(hg prompt "☿ {rev}@{branch}") $st
|
||||||
|
else
|
||||||
|
st=""
|
||||||
|
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||||
|
branch=$(hg id -b 2>/dev/null)
|
||||||
|
if `hg st | grep -Eq "^\?"`; then
|
||||||
|
prompt_segment red black
|
||||||
|
st='±'
|
||||||
|
elif `hg st | grep -Eq "^(M|A)"`; then
|
||||||
|
prompt_segment yellow black
|
||||||
|
st='±'
|
||||||
|
else
|
||||||
|
prompt_segment green black
|
||||||
|
fi
|
||||||
|
echo -n "☿ $rev@$branch" $st
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Dir: current working directory
|
||||||
|
prompt_dir() {
|
||||||
|
prompt_segment 238 grey '%~'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Virtualenv: current working virtualenv
|
||||||
|
prompt_virtualenv() {
|
||||||
|
local virtualenv_path="$VIRTUAL_ENV"
|
||||||
|
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
|
||||||
|
prompt_segment blue black "(`basename $virtualenv_path`)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## left prompt
|
||||||
|
build_prompt() {
|
||||||
|
RETVAL=$?
|
||||||
|
prompt_virtualenv
|
||||||
|
prompt_context
|
||||||
|
prompt_dir
|
||||||
|
prompt_git
|
||||||
|
prompt_hg
|
||||||
|
prompt_end
|
||||||
|
}
|
||||||
|
|
||||||
|
## right prompt
|
||||||
|
build_rprompt() {
|
||||||
|
RETVAL=$?
|
||||||
|
local symbols
|
||||||
|
symbols=()
|
||||||
|
drawrightprompt=0
|
||||||
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" && drawrightprompt=1
|
||||||
|
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" && drawrightprompt=1
|
||||||
|
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘ $RETVAL" && drawrightprompt=1
|
||||||
|
if [[ "$drawrightprompt" -eq 1 ]]; then
|
||||||
|
prompt_rseperator %k 238
|
||||||
|
fi
|
||||||
|
[[ -n "$symbols" ]] && prompt_segment 236 default "$symbols"
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT='%{%f%b%k%}$(build_prompt) '
|
||||||
|
RPROMPT='%{%f%r%k%}$(build_rprompt) '
|
||||||
|
|
||||||
|
|
||||||
35
zshrc
35
zshrc
|
|
@ -40,12 +40,8 @@ if [[ "$COLORTERM" == "rxvt-xpm" ]]; then
|
||||||
export TERM="rxvt-unicode-256color"
|
export TERM="rxvt-unicode-256color"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set $OS_TYPE to "osx" / "linux":
|
# set $OS_TYPE
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
export OS_TYPE="$(uname)"
|
||||||
export OS_TYPE="osx"
|
|
||||||
else
|
|
||||||
export OS_TYPE="linux"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# $ZSH - Path to your zsh installation.
|
# $ZSH - Path to your zsh installation.
|
||||||
export ZSH=$HOME/.zsh/
|
export ZSH=$HOME/.zsh/
|
||||||
|
|
@ -104,10 +100,9 @@ export LC_ALL="en_US.UTF-8"
|
||||||
|
|
||||||
# set ls options
|
# set ls options
|
||||||
LS_OPTIONS="--color=auto --group-directories-first -F"
|
LS_OPTIONS="--color=auto --group-directories-first -F"
|
||||||
alias ls="ls $LS_OPTIONS"
|
|
||||||
|
|
||||||
# Mac OS X specific stuff:
|
# Mac OS X specific stuff:
|
||||||
if [[ "$OS_TYPE" == "osx" ]]; then
|
if [[ "$OS_TYPE" == "Darwin" ]]; then
|
||||||
# preceed path with homebrew stuff:
|
# preceed path with homebrew stuff:
|
||||||
export PATH="/usr/local/sbin:/usr/local/bin:$PATH"
|
export PATH="/usr/local/sbin:/usr/local/bin:$PATH"
|
||||||
# ipython on mac:
|
# ipython on mac:
|
||||||
|
|
@ -133,6 +128,21 @@ else
|
||||||
LS_COMMAND="ls"
|
LS_COMMAND="ls"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$OS_TYPE" == "FreeBSD" ]]; then
|
||||||
|
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'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# enable ls colorization:
|
# enable ls colorization:
|
||||||
if [ "$TERM" != "dumb" ]; then
|
if [ "$TERM" != "dumb" ]; then
|
||||||
eval "$(dircolors "$ZSH"/dircolors)"
|
eval "$(dircolors "$ZSH"/dircolors)"
|
||||||
|
|
@ -143,7 +153,7 @@ fi
|
||||||
export SHELL="$(which zsh)"
|
export SHELL="$(which zsh)"
|
||||||
|
|
||||||
# keychain stuff
|
# keychain stuff
|
||||||
if [[ "$OS_TYPE" == "linux" ]]; then
|
if [[ "$OS_TYPE" == "Linux" ]]; then
|
||||||
ssh_cmd="$(which ssh)"
|
ssh_cmd="$(which ssh)"
|
||||||
function ssh () {
|
function ssh () {
|
||||||
echo "$@" >> $HOME/.keychain-args
|
echo "$@" >> $HOME/.keychain-args
|
||||||
|
|
@ -175,5 +185,10 @@ alias sudo='nocorrect sudo'
|
||||||
# the more brutal attempt:
|
# the more brutal attempt:
|
||||||
unsetopt correct{,all}
|
unsetopt correct{,all}
|
||||||
|
|
||||||
alias sd='ssh deep'
|
# colored grep / less
|
||||||
|
alias grep="grep --color='always'"
|
||||||
|
alias less='less -R'
|
||||||
|
alias diff='colordiff'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue