From 2f9cb6f18255cc7243a6ed2a0c452c1aee936fe1 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 30 Jun 2017 14:33:59 +0200 Subject: Modifs en vrac --- 01_Internal.zsh | 22 ++++++++++-------- 10_Environment.zsh | 2 +- 11_Colors.zsh | 3 ++- 12_Prompts.zsh | 6 ++++- 13_ZshHighlight.zsh | 6 ++--- Tcaps | 36 +++++++++++++++++++++++++---- net:anevia.com/user:hhiegel/Aliases.zsh | 11 +++++++++ net:anevia.com/user:hhiegel/Colors.zsh | 1 + net:anevia.com/user:hhiegel/Environment.zsh | 2 ++ user:hugues/Aliases.zsh | 6 +++-- user:hugues/GusBindings.zsh | 6 +++-- zshrc | 2 +- 12 files changed, 78 insertions(+), 25 deletions(-) diff --git a/01_Internal.zsh b/01_Internal.zsh index 20c02c3..50cc1b2 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -372,7 +372,7 @@ __get_git_tracking_status() { svn_rev=$(git svn find-rev $svn_track) # eval $( git svn info | awk '/^URL: / { print "svn_url="$2 } # /^Repository UUID: / { print "svn_repo="$3 } - # /^Last Changed Rev: / { print "svn_rev="$2 } + # /^Last Changed Rev: / { print "svn_rev="$4 } # ') # svn_track=$(git log --grep="git-svn-id: $svn_url@$svn_rev $svn_repo" --pretty=%h -1) @@ -631,7 +631,7 @@ __hbar() __debug -n " Horizontal bar..." _COLUMNS_OLD=$COLUMNS HBAR_COLOR=$C_$_prompt_colors[bar]$_C$T_ - HBAR=$T_${${(l:${COLUMNS}::q:)}//q/$_tq_}$_T + HBAR=$T_${${(l:${COLUMNS}::-:)}//-/$_tq_}$_T __debug fi } @@ -686,15 +686,16 @@ zle -N _rehash _process_tree() { FULLCMD=0 - if [ "$1" = "-f" ] - then - FULLCMD=1 - shift - fi + SHOWPIDS=0 + case $1 in + -f) FULLCMD=1 ; shift ;; + -p) SHOWPIDS=1 ; shift ;; + *) ;; + esac for leaf in ${@:-$$} do - ps -wweo pid,ppid,command | awk -v fullcmd=$FULLCMD -v leaf="$leaf" \ + ps -wweo pid,ppid,command | awk -v fullcmd=$FULLCMD -v showpids=$SHOWPIDS -v leaf="$leaf" \ '{ parent[$1]=$2 ; command[$1]=$3 ; @@ -706,8 +707,9 @@ _process_tree() } function print_ancestry(pid) { - if (pid != 1) { print_ancestry(parent[pid]) ; printf " :: " } - printf command[pid]; + if (pid != 1) { print_ancestry(parent[pid]) ; if (!showpids) { printf " :: " } else { printf " " } } + if (showpids) { printf pid } + else { printf command[pid] } }; END { print_ancestry(leaf) diff --git a/10_Environment.zsh b/10_Environment.zsh index 6df2e25..e21a5fe 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -95,7 +95,7 @@ fi _current_display=$(finger 2>&- | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9][[:blank:]]+($DISPLAY)' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) if [ "$DISPLAY" = "" -a "$_current_display" = "" ] then - _guess_display=$(finger 2>&- | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9]' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) + _guess_display=$(finger | awk '( NR > 1 && $8 ~ /:[0-9]/ ) { print $8 ; exit }' | tr -d '()') if [ "$_guess_display" != "" ] then export DISPLAY=$_guess_display diff --git a/11_Colors.zsh b/11_Colors.zsh index d5ae7ce..bf4b5c6 100644 --- a/11_Colors.zsh +++ b/11_Colors.zsh @@ -76,7 +76,8 @@ __set_prompt_colors () _agent_colors[remote_empty]="$color[bold];$color[black]" _agent_colors[has_keys]="$_prompt_colors[bold_generic]" _agent_colors[has_remote_keys]="$_prompt_colors[bold_generic]" - _agent_colors[id_dsa]="$color[bold];$color[yellow]" + _agent_colors[id_rsa]="$color[bold];$color[yellow]" + _agent_colors[anevia_dsa]="$color[bold];$color[green]" _gcl_colors[init]="$color[black];$color[bold]" _gcl_colors[gitdir]="$color[red];$color[bold]" diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 61db556..18a4221 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -138,7 +138,8 @@ __ssh_gpg_agents () AgentChar=${AGENT_WITH_KEYS:-✔} for i in $(echo $SSH_AGENT_KEYLIST | cut -d' ' -f3 ) do - AGENTS=$AGENTS$C_${_agent_colors[$i:t]:-$_agent_colors[has_keys]}$_C$AgentChar + i=$(( 0x$(crc32 =(echo ${i:t})) % (6*6) * 6 + 16 )) + AGENTS=$AGENTS$C_"1;38;5;$i"$_C$AgentChar done else AGENTCOLOR="empty" @@ -377,6 +378,9 @@ precmd() __update_prompt_elements __redefine_prompt + + # sanity + setterm -c on } diff --git a/13_ZshHighlight.zsh b/13_ZshHighlight.zsh index f0fe8bd..23bbe9f 100644 --- a/13_ZshHighlight.zsh +++ b/13_ZshHighlight.zsh @@ -18,13 +18,13 @@ ZSH_HIGHLIGHT_STYLES[assign]="fg=cyan" ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]="fg=yellow,bold" ZSH_HIGHLIGHT_STYLES[back-quoted-argument]="green" -ZSH_HIGHLIGHT_STYLES[bracket-error]="fg=red,bold" +ZSH_HIGHLIGHT_STYLES[bracket-error]="fg=red,bg=black,bold" ZSH_HIGHLIGHT_STYLES[bracket-level-1]="fg=yellow,bold" ZSH_HIGHLIGHT_STYLES[bracket-level-2]="fg=green" ZSH_HIGHLIGHT_STYLES[bracket-level-3]="fg=cyan,bold" ZSH_HIGHLIGHT_STYLES[bracket-level-4]="fg=blue" ZSH_HIGHLIGHT_STYLES[bracket-level-5]="fg=magenta" -ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]="fg=white,underline,bold" +ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]="bg=green,fg=yellow,bold" ZSH_HIGHLIGHT_STYLES[precommand]="fg=blue,bold" @@ -38,7 +38,7 @@ ZSH_HIGHLIGHT_STYLES[function]="fg=cyan,bold,underline" ZSH_HIGHLIGHT_STYLES[history-expansion]="fg=blue" ZSH_HIGHLIGHT_STYLES[path]="fg=blue" -ZSH_HIGHLIGHT_STYLES[path_approx]="fg=magenta,bg=color106" +ZSH_HIGHLIGHT_STYLES[path_approx]="fg=red,bold" ZSH_HIGHLIGHT_STYLES[globbing]="fg=blue,bold" ZSH_HIGHLIGHT_STYLES[commandseparator]="none" diff --git a/Tcaps b/Tcaps index 07a22e3..a2ef67e 100644 --- a/Tcaps +++ b/Tcaps @@ -1,12 +1,40 @@ #!/bin/zsh - -T_=${has_termcaps:+$termcap[as]} -_T=${has_termcaps:+$termcap[ae]} -_tq_=${${has_termcaps:+"q"}:-"-"} +# +# + right arrow (>) +# , left arrow (<) +# . down arrow (v) +# 0 full square (#) +# I lantern (#) +# - upper arrow (^) +# ' rhombus (+) +# a chess board (:) +# f degree (') +# g plus-minus (#) +# h square (#) +# j right bottom corner (+) +# k right upper corner (+) +# l left upper corner (+) +# m left bottom corner (+) _tj_=${${has_termcaps:+"j"}:-"'"} _tk_=${${has_termcaps:+"k"}:-"."} _tl_=${${has_termcaps:+"l"}:-","} _tm_=${${has_termcaps:+"m"}:-"\`"} +# n cross (+) +# o upper horizontal line (-) +# q middle horizontal line (-) +_tq_=${${has_termcaps:+"q"}:-"-"} +# s bottom horizontal line (_) +# t left tee (+) +# u right tee (+) _tt_=${${has_termcaps:+"t"}:-"]"} _tu_=${${has_termcaps:+"u"}:-"["} +# v bottom tee (+) +# w normal tee (+) +# x vertical line (|) _tx_=${${has_termcaps:+"x"}:-"|"} +# ~ paragraph (???) + + + +T_=${has_termcaps:+$termcap[as]} +_T=${has_termcaps:+$termcap[ae]} diff --git a/net:anevia.com/user:hhiegel/Aliases.zsh b/net:anevia.com/user:hhiegel/Aliases.zsh index 7596981..8d3ea2f 100644 --- a/net:anevia.com/user:hhiegel/Aliases.zsh +++ b/net:anevia.com/user:hhiegel/Aliases.zsh @@ -1,3 +1,14 @@ alias pbuilder='sudo DIST=$DIST BASE=$BASE ARCH=$ARCH pbuilder' +function udp() { echo -n "vlc --playlist-enqueue ${VLCOPTS}" ; for i in $@ ; do echo -n " udp://@${i}" ; done } +alias qemu='sudo qemu-system-x86_64 -m 1024 -enable-kvm -net nic,vlan=0,macaddr=00:06:86:01:30:63 -net tap,vlan=0,ifname=tap0,script=no,downscript=no' + + +# OBSOLETE : use flash_usb.sh instead. +# function bin2dom() { +# docker run --rm --privileged=true -v $1:$1 -v $(dirname $(readlink -f $2)):/fw \ +# registry.anevia.com/build/wheezy64 bin2dom.sh -k -o $1 \ +# /fw/$(basename $2) +# } +alias bin2dom="flash_usb.sh" diff --git a/net:anevia.com/user:hhiegel/Colors.zsh b/net:anevia.com/user:hhiegel/Colors.zsh index 8c8432f..cba6fb1 100644 --- a/net:anevia.com/user:hhiegel/Colors.zsh +++ b/net:anevia.com/user:hhiegel/Colors.zsh @@ -4,6 +4,7 @@ typeset -A _env_colors _env_colors[dist_none]="38;5;19" _env_colors[dist_lenny]="38;5;21" _env_colors[dist_wheezy]="38;5;26" +_env_colors[dist_jessie]="38;5;46" _env_colors[base_none]="38;5;196" _env_colors[base_stable]="38;5;82" diff --git a/net:anevia.com/user:hhiegel/Environment.zsh b/net:anevia.com/user:hhiegel/Environment.zsh index 300a371..3c7b5c9 100644 --- a/net:anevia.com/user:hhiegel/Environment.zsh +++ b/net:anevia.com/user:hhiegel/Environment.zsh @@ -4,3 +4,5 @@ PATH+=:~/Work/Tools/bin export EMAIL="hugues.hiegel@anevia.com" export DEBFULLNAME="Hugues Hiegel" +#export MENUCONFIG_COLOR=blackbg + diff --git a/user:hugues/Aliases.zsh b/user:hugues/Aliases.zsh index 4a2322b..aefe795 100644 --- a/user:hugues/Aliases.zsh +++ b/user:hugues/Aliases.zsh @@ -34,8 +34,6 @@ then a vim='vim --servername `print -P "%l"`' fi -__cmd_exists eject && a close='eject -t' - a goto='cd -P' ## Resolve symlinks a so='cd -' @@ -45,7 +43,11 @@ a cp && una cp ## Dé-assigne les alias de ``cp'' autoload zmv a mmv='noglob zmv -W' +# Not an alias, but.. +where() { cd $(dirname $(readlink -f $(which $1))) } + __normal_user && __cmd_exists apt-get && a apt-get='sudo apt-get' +__normal_user && __cmd_exists apt && a apt='sudo apt' __normal_user && __cmd_exists pacman && a pacman='sudo pacman' __normal_user && __cmd_exists yum && a yum='sudo yum' diff --git a/user:hugues/GusBindings.zsh b/user:hugues/GusBindings.zsh index 03fec0c..b156e68 100644 --- a/user:hugues/GusBindings.zsh +++ b/user:hugues/GusBindings.zsh @@ -216,10 +216,12 @@ do bindkey -M $keymap -s '^[T' '^[Q todo all -c\n' fi - bindkey -M $keymap -s '^[c' '^[Q [ ! -e configure ] && ( ./autogen.sh && ./configure ) || ./configure\n' + alias configure="[ ! -e configure ] && ( ./autogen.sh && ./configure ) || ./configure" + bindkey -M $keymap -s '^[c' '^[Q configure\n' bindkey -M $keymap -s '^[©' '^[Q !?configure\n' - bindkey -M $keymap -s '^[m' '^[Q [ ! -e Makefile -a ! -e GNUmakefile ] && ( [ ! -e configure ] && ./autogen.sh ; ./configure && make ) || make\n' + alias MAKE="[ ! -e Makefile -a ! -e GNUmakefile ] && ( [ ! -e configure ] && ./autogen.sh ; ./configure && make ) || make" + bindkey -M $keymap -s '^[m' '^[Q MAKE\n' bindkey -M $keymap -s '^[M' '^[Q make\n' bindkey -M $keymap -s '^[l' '^[Q l\n' diff --git a/zshrc b/zshrc index 499ad3c..d87187b 100644 --- a/zshrc +++ b/zshrc @@ -36,7 +36,7 @@ USER=${USER:-`whoami`} UID=${UID:-`id -u`} HOST=$HOST:r HOST=${HOST:-$(hostname -s)} -DOMAIN=$(hostname -a 2>&-| sed 's/^[^\.]*\.\?//') +DOMAIN=anevia.com # $(hostname -a 2>&-| sed 's/^[^\.]*\.\?//') DOMAIN=${DOMAIN:-$(hostname -d 2>&-)} DOMAIN=${DOMAIN:-$(hostname -y 2>&-)} [ "$DOMAIN" = "" -o "$DOMAIN" = "localdomain" -o "$DOMAIN" = "(none)" ] && DOMAIN=$(grep "^search " /etc/resolv.conf | cut -d' ' -f2) -- cgit v1.2.3