From 0016ab05ecd2959c3a69d42d34ada53c13a18d96 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 3 Jun 2009 10:36:56 +0200 Subject: [Funcs/git] Get branch on an initialized repo with symlink HEAD --- 01_Functions.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index ad4c10a..35cc361 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -106,7 +106,12 @@ get_git_branch () fi else # Initial commit - my_git_branch="$(basename $GIT_DIR/$(cat $GIT_DIR/HEAD | sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)$/objects\/\1\/\2/;s/^ref: //'))" + if [ -L $GIT_DIR/HEAD -a ! -f $GIT_DIR/HEAD ] + then + my_git_branch="$(basename $GIT_DIR/$(stat --printf="%N\n" $GIT_DIR/HEAD | tr '`' "'" | cut -d\' -f4))" + else + my_git_branch="$(basename $GIT_DIR/$(cat $GIT_DIR/HEAD | sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)$/objects\/\1\/\2/;s/^ref: //'))" + fi fi echo $my_git_branch -- cgit v1.2.3 From 595765301aae9c7dafa01aa3d89b654968cb2380 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 10 Mar 2009 11:55:08 +0100 Subject: [ZSHRC] OS-specific config --- zshrc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index 01700cb..657a810 100644 --- a/zshrc +++ b/zshrc @@ -14,6 +14,7 @@ # # If you want to make user, host or network specific configurations, # add your specific scripts to the folders +# - "sys:$(uname -s)" for OS-specific conf, # - "user:$(whoami)" for user-specific conf, # - "host:$(hostname -s)" for host-specific conf, # - "net:$(domainname)" for network-specific conf, @@ -28,6 +29,7 @@ mkdir -p $ZDOTDIR # Useful environment variables which may be used # at any time - We compute them now to avoid calling # the required processes each time we'll need. +OSNAME=`uname -s` USER=${USER:-`whoami`} UID=${UID:-`id -u`} HOST=$HOST:r @@ -49,15 +51,24 @@ if [ -d $ZDOTDIR ]; then for i in "net:$DOMAIN"\ "host:$HOST"\ + "sys:$OSNAME"\ "user:$USER"\ "user:$SUDO_USER"\ "net:$DOMAIN/host:$HOST"\ + "net:$DOMAIN/sys:$OSNAME"\ "net:$DOMAIN/user:$USER"\ "net:$DOMAIN/user:$SUDO_USER"\ + "net:$DOMAIN/host:$HOST/sys:$OSNAME"\ "net:$DOMAIN/host:$HOST/user:$USER"\ "net:$DOMAIN/host:$HOST/user:$SUDO_USER"\ + "net:$DOMAIN/host:$HOST/sys:$OSNAME"\ + "net:$DOMAIN/host:$HOST/sys:$OSNAME/user:$USER"\ + "net:$DOMAIN/host:$HOST/sys:$OSNAME/user:$SUDO_USER"\ + "host:$HOST/sys:$OSNAME"\ "host:$HOST/user:$USER"\ - "host:$HOST/user:$SUDO_USER" + "host:$HOST/user:$SUDO_USER"\ + "host:$HOST/sys:$OSNAME/user:$USER"\ + "host:$HOST/sys:$OSNAME/user:$SUDO_USER" do specific_script=${script:h}/$i/${${script:t}/??_/} if test -f $specific_script -- cgit v1.2.3 From 18a21d023d93b820ca1e1a876af26e7fd85fc35e Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 10 Mar 2009 11:55:35 +0100 Subject: [Prunelle] Specific config for Darwin-OS --- net:sweethome/host:prunelle/Aliases.zsh | 16 -------------- net:sweethome/host:prunelle/Environment.zsh | 18 ---------------- net:sweethome/host:prunelle/sys:Darwin/Aliases.zsh | 12 +++++++++++ .../host:prunelle/sys:Darwin/Environment.zsh | 25 ++++++++++++++++++++++ 4 files changed, 37 insertions(+), 34 deletions(-) delete mode 100644 net:sweethome/host:prunelle/Aliases.zsh create mode 100644 net:sweethome/host:prunelle/sys:Darwin/Aliases.zsh create mode 100644 net:sweethome/host:prunelle/sys:Darwin/Environment.zsh diff --git a/net:sweethome/host:prunelle/Aliases.zsh b/net:sweethome/host:prunelle/Aliases.zsh deleted file mode 100644 index 7c2a390..0000000 --- a/net:sweethome/host:prunelle/Aliases.zsh +++ /dev/null @@ -1,16 +0,0 @@ -## -## Part of configuration files for Zsh 4 -## by Hugues Hiegel -## -## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS -## -## You are encouraged to use, modify, and redistribute -## these files with or without this notice. -## - -if [ "$OSTYPE" == "Darwin" ] -then - a port='sudo port' - a ls='ls -FG' - a aless='open -a /Applications/DarwinPorts/AquaLess.app' -fi diff --git a/net:sweethome/host:prunelle/Environment.zsh b/net:sweethome/host:prunelle/Environment.zsh index 248b742..e96318b 100644 --- a/net:sweethome/host:prunelle/Environment.zsh +++ b/net:sweethome/host:prunelle/Environment.zsh @@ -8,24 +8,6 @@ ## these files with or without this notice. ## -if ( [ "`uname -s`" = "Darwin" ] ) -then - export DISPLAY=:0 - - ## Fink / DarwinPorts - - MANPATH=/usr/share/man - INFOPATH=/usr/share/info - - for i in usr/X11R6 dp sw ; do - export PATH=$PATH:/$i/bin:/$i/sbin - export MANPATH=$MANPATH:/$i/share/man - export INFOPATH=$INFOPATH:/$i/share/info - done - - typeset -gU PATH MANPATH INFOPATH -fi - PS1_USER="1" if [ "$OSTYPE" = "linux-gnu" ] then diff --git a/net:sweethome/host:prunelle/sys:Darwin/Aliases.zsh b/net:sweethome/host:prunelle/sys:Darwin/Aliases.zsh new file mode 100644 index 0000000..cc1173a --- /dev/null +++ b/net:sweethome/host:prunelle/sys:Darwin/Aliases.zsh @@ -0,0 +1,12 @@ +## +## Part of configuration files for Zsh 4 +## by Hugues Hiegel +## +## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS +## +## You are encouraged to use, modify, and redistribute +## these files with or without this notice. +## +a port='sudo port' +a ls='ls -FG' +a aless='open -a /Applications/DarwinPorts/AquaLess.app' diff --git a/net:sweethome/host:prunelle/sys:Darwin/Environment.zsh b/net:sweethome/host:prunelle/sys:Darwin/Environment.zsh new file mode 100644 index 0000000..dd8d36a --- /dev/null +++ b/net:sweethome/host:prunelle/sys:Darwin/Environment.zsh @@ -0,0 +1,25 @@ +#!/bin/zsh +## +## Part of configuration files for Zsh 4 +## by Hugues Hiegel +## +## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS +## +## You are encouraged to use, modify, and redistribute +## these files with or without this notice. +## + +export DISPLAY=:0 + +## Fink / DarwinPorts + +MANPATH=/usr/share/man +INFOPATH=/usr/share/info + +for i in usr/X11R6 dp sw ; do + export PATH=$PATH:/$i/bin:/$i/sbin + export MANPATH=$MANPATH:/$i/share/man + export INFOPATH=$INFOPATH:/$i/share/info +done + +typeset -gU PATH MANPATH INFOPATH -- cgit v1.2.3 From 3b01e9c17d767c0e148fda1d2609ba27628f4c01 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 14 May 2009 14:42:43 +0200 Subject: [Darwin] updated env paths --- net:sweethome/host:prunelle/sys:Darwin/Environment.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net:sweethome/host:prunelle/sys:Darwin/Environment.zsh b/net:sweethome/host:prunelle/sys:Darwin/Environment.zsh index dd8d36a..5fac52b 100644 --- a/net:sweethome/host:prunelle/sys:Darwin/Environment.zsh +++ b/net:sweethome/host:prunelle/sys:Darwin/Environment.zsh @@ -16,10 +16,10 @@ export DISPLAY=:0 MANPATH=/usr/share/man INFOPATH=/usr/share/info -for i in usr/X11R6 dp sw ; do - export PATH=$PATH:/$i/bin:/$i/sbin - export MANPATH=$MANPATH:/$i/share/man - export INFOPATH=$INFOPATH:/$i/share/info +for i in /dp /sw /usr/X11R6 ; do + export PATH=$i/bin:$i/sbin:$PATH + export MANPATH=$i/share/man:$MANPATH + export INFOPATH=/$i/share/info:$INFOPATH done typeset -gU PATH MANPATH INFOPATH -- cgit v1.2.3 From 88cc186983054e074e13811d981582e8f31904cd Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 14 May 2009 14:46:00 +0200 Subject: [Sweethome] PS1_COLORS moved to host:paranoid/user:hugues --- .../host:paranoid/user:hugues/Environment.zsh | 19 +++++++++++++++++++ net:sweethome/user:hugues/Environment.zsh | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 net:sweethome/host:paranoid/user:hugues/Environment.zsh delete mode 100644 net:sweethome/user:hugues/Environment.zsh diff --git a/net:sweethome/host:paranoid/user:hugues/Environment.zsh b/net:sweethome/host:paranoid/user:hugues/Environment.zsh new file mode 100644 index 0000000..22ede24 --- /dev/null +++ b/net:sweethome/host:paranoid/user:hugues/Environment.zsh @@ -0,0 +1,19 @@ + +PS1_SUDO=${PS1_SUDO:-$color[green]} +PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} +#PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} +PS1_USER_SCR=$PS1_USER + +if ( [ "$SSH_TTY" != "" ] ) +then + PS1_USER=$PS1_USER_SSH +fi +if ( echo "$TERM" | grep "^screen.*$" >/dev/null ) +then + PS1_USER=$PS1_USER_SCR +fi +if ( [ ! -z "$SUDO_USER" ] ) +then + PS1_USER=$PS1_SUDO +fi + diff --git a/net:sweethome/user:hugues/Environment.zsh b/net:sweethome/user:hugues/Environment.zsh deleted file mode 100644 index 22ede24..0000000 --- a/net:sweethome/user:hugues/Environment.zsh +++ /dev/null @@ -1,19 +0,0 @@ - -PS1_SUDO=${PS1_SUDO:-$color[green]} -PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} -#PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} -PS1_USER_SCR=$PS1_USER - -if ( [ "$SSH_TTY" != "" ] ) -then - PS1_USER=$PS1_USER_SSH -fi -if ( echo "$TERM" | grep "^screen.*$" >/dev/null ) -then - PS1_USER=$PS1_USER_SCR -fi -if ( [ ! -z "$SUDO_USER" ] ) -then - PS1_USER=$PS1_SUDO -fi - -- cgit v1.2.3 From d973614c6c9df79f21c74c1340229cb9b619ca34 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Thu, 4 Jun 2009 23:35:24 +0200 Subject: [Env] sudo_password --- user:hugues/Environment.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user:hugues/Environment.zsh b/user:hugues/Environment.zsh index f532fe2..1670723 100644 --- a/user:hugues/Environment.zsh +++ b/user:hugues/Environment.zsh @@ -64,4 +64,6 @@ WATCH=notme WORDCHARS='*?-_~!#$%^' ## Caractères faisant partie des mots ## J'ai viré les '/()[]{}' +export SUDO_PROMPT="%u has to enter passwd to become %U: " + MUSICPLAYER=audacious -- cgit v1.2.3 From 7e6dee86f24c41338c9294dbd5f83ce8155b6d96 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 3 Jun 2009 14:13:51 +0200 Subject: [Funcs/git] shows added files in git branch --- 01_Functions.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index 35cc361..3b7a517 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -114,6 +114,11 @@ get_git_branch () fi fi + if [ "$(git-status 2>&- | grep "new file" | head -n1)" != "" ] ; then + # ADDED FILES + my_git_branch=$my_git_branch" (+)" + fi + echo $my_git_branch } @@ -136,7 +141,7 @@ get_git_status () if [ "$(git-diff --cached 2>&- | grep '^diff ' | head -n1 )" != "" ] ; then cached="yes" fi - if [ "$(git-ls-files -m 2>&-)" != "" ] ; then + if [ "$(git-ls-files -m 2>&- | head -n1)" != "" ] ; then not_up_to_date="yes" fi -- cgit v1.2.3 From bcd0823d15c93d0c6ec404860bb45aa8b4e6d283 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 5 Jun 2009 00:14:16 +0200 Subject: [Prompts] better multibyte on/off managment for ssh/gpg agents --- 12_Prompts.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/12_Prompts.zsh b/12_Prompts.zsh index bdbb55a..68bcc5f 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -115,11 +115,11 @@ update_prompt() SSH_AGENT_KEYLIST="$( ssh-add -l | grep "^[[:digit:]]\+ \([[:digit:]a-f]\{2\}:\)\{15\}[[:digit:]a-f]\{2\} .* (.*)$" )" local _is_multibyte_compliant - if ( echo ${(k)options} | grep "multibyte" >/dev/null && [ "$options[multibyte]" = "on" ] ) + if ( echo ${(k)options} | grep "multibyte" >/dev/null ) && [ "$options[multibyte]" = "on" ] then - _is_multibyte_compliant=1 + _is_multibyte_compliant="yes it is !" else - _is_multibyte_compliant=0 + _is_multibyte_compliant="" fi # Check if it is a forwarded agent @@ -129,20 +129,20 @@ update_prompt() if [ "$SSH_AGENT_KEYLIST" != "" ] then AGENTCOLOR="has_keys" - AGENTCHAR=${AGENT_WITH_KEYS:-$( [ _is_multibyte_compliant ] && echo "★" || echo "§" )} + AGENTCHAR=${AGENT_WITH_KEYS:-$( [ $_is_multibyte_compliant ] && echo "★" || echo "S" )} else AGENTCOLOR="empty" - AGENTCHAR=${AGENT_EMPTY:-$( [ _is_multibyte_compliant ] && echo "☆" || echo "§" )} + AGENTCHAR=${AGENT_EMPTY:-$( [ $_is_multibyte_compliant ] && echo "☆" || echo "S" )} fi else # That's a forwarded agent if [ "$SSH_AGENT_KEYLIST" != "" ] then AGENTCOLOR="has_keys" - AGENTCHAR=${AGENT_SOCK_WITH_KEYS:-$( [ _is_multibyte_compliant ] && echo "●" || echo "@" )} + AGENTCHAR=${AGENT_SOCK_WITH_KEYS:-$( [ $_is_multibyte_compliant ] && echo "●" || echo "@" )} else AGENTCOLOR="empty" - AGENTCHAR=${AGENT_SOCK_EMPTY:-$( [ _is_multibyte_compliant ] && echo "○" || echo "@" )} + AGENTCHAR=${AGENT_SOCK_EMPTY:-$( [ $_is_multibyte_compliant ] && echo "○" || echo "@" )} fi fi @@ -155,7 +155,7 @@ update_prompt() if [ "`strings /proc/$GPG_AGENT_PID/cmdline | head -n1`" = "gpg-agent" ] then AGENTCOLOR="has_keys" - AGENTS=$AGENTS$C_$agent_colors[$AGENTCOLOR]$_C${GPG_AGENT_RUNNING:-$( [ _is_multibyte_compliant ] && echo "☆" || echo "G" )} + AGENTS=$AGENTS$C_$agent_colors[$AGENTCOLOR]$_C${GPG_AGENT_RUNNING:-$( [ $_is_multibyte_compliant ] && echo "☆" || echo "G" )} fi fi AGENTS=${AGENTS:+$C_$prompt_colors[bar]$_C"-"$AGENTS} -- cgit v1.2.3