salut a tous,
soit la fonction suivante:
cpan_to_deb_name () {
typeset -a v
v=( ${(L)@//::/-} )
print -l lib-$^v-perl
}
> cpan_to_deb_name Algorithm::CheckDigits::M43_001
lib-algorithm-checkdigits-m43_001-perl
v n'existe que parceque je n'ai pas ete foutu d'ecrire qqchose du genre
cpan_to_deb_name () { print -l lib-$^{(L)@//::/-}-perl }
mais moi je suis nul et je suis sur que l'un d'entre vous saura ou j'ai
fauté dans mes diffétentes tentatives.
bien cordialement,
ps: désolé pour le cross-posting mais je compte proceder ainsi tant que
les deux responsables de listes n'auront pas trouvé de solution.
--
Marc Chantreux
BibLibre, expert en logiciels libres pour l'info-doc
http://biblibre.com
Bonsoir à tous,
suite a quelques reflexions/dicussions avec certaines personnes qui se
reconnaitront, je souhaiterais faire une configuration zsh
generique/universelle d'apres nos configurations a tous.
Dans ce but, je vais mettre a dispo un repository git (enfin c'est ce
qui est prevu) pour permettre a tous de proposer des patchs facilement,
et permettre aux admins d'accepter/refuser/modifier les patchs modifiés.
Le but est de fournir une configuration complete, mais adaptee a chacun.
J'ai donc quelques questions :
0/ qu'en pensez vous ?
1/ qui est motive a participe a cette config ? (vincent et marc, je
comptes un peu sur vous *entre autres* ;p)
2/ qui est interesse par etre "admin" (i.e. accepter/refuser les patchs)
merci de votre attention !
--
http://asyd.net/home/ - Home Page
http://guses.org/home/ - French Speaking (Open)Solaris User Group
A page in your DokuWiki was added or changed. Here are the details:
Date : 2008/04/07 20:45
Browser : @BROWSER@
IP-Address : @IPADDRESS@
Hostname : @HOSTNAME@
Old Revision: http://zshwiki.org/home/test?rev=1207348157
New Revision: http://zshwiki.org/home/test
Edit Summary: removed
User : splitbrain
@@ -1,3 +1 @@
- test
-
--
This mail was generated by DokuWiki at
http://zshwiki.org/home/
A page in your DokuWiki was added or changed. Here are the details:
Date : 2008/04/05 20:23
Browser : @BROWSER@
IP-Address : @IPADDRESS@
Hostname : @HOSTNAME@
Old Revision: http://zshwiki.org/home/config/prompt?rev=1207346622
New Revision: http://zshwiki.org/home/config/prompt
Edit Summary: Fixed some bugs in the 'soor' prompt
User : creidiki
@@ -56,15 +56,19 @@
% prompt bart
</code>
Simple enough, isn't it?
+
==== Prompt Examples ====
Some examples of what you can do with zsh prompts.
Using styles to make flexible prompts:
<code>
+ # -*- mode: sh; -*-
+ # soor prompt theme
+
prompt_soor_help () {
cat <<'EOF'
This prompt is configurable via styles:
@@ -101,9 +105,9 @@
precmd () {
local p_full
- local p_tchars p_temp p_done p_last
+ local p_tchars p_temp p_done p_last i
local maxlength ratio
local prompt_color
local user_color
local root_color
@@ -140,9 +144,9 @@
case "${path_style}" in
ratio)
zstyle -s :prompt:soor ratio ratio
ratio=${ratio:-6}
- maxlength=$(($COLUMNS/$ratio))
+ maxlength=$(( ${COLUMNS} / ${ratio} ))
;;
fixed)
zstyle -s :prompt:soor length maxlength
maxlength=${maxlength:-20}
@@ -154,39 +158,31 @@
esac
case "${path_style}" in
full)
- p_done="%~"
+ path_prompt=$(print -P %~)
;;
subdir)
- p_done=$(print -P "%(4~|..|)%${maxlength}~")
+ path_prompt=$(print -P "%($(( ${maxlength} + 1 ))~|..|)%${maxlength}~")
;;
ratio|fixed)
- p_full=$(print -P %~)
- if [[ ${#p_full} -le ${maxlength} ]]; then
- p_done="${p_full}"
- else
- # I don't actually remember how this little snippet works.
- # But it /does/, somehow, so I'm not touching it.
+ path_prompt=$(print -P %~)
+ if (( ${#path_prompt} > ${maxlength} )); then
p_tchars='../'
+ p_done=${path_prompt}
for (( i=1 ; ; ++i )); do
- p_temp="${p_tchars}$(print -P %${i}~)"
- if [[ ${#p_temp} -gt ${maxlength} ]]; then
- if [[ -n ${p_last} ]]; then
- p_done="${p_last}"
- else
- p_done="${p_temp}"
- fi
+ p_temp=$(print -P %${i}~)
+ if (( ( ${#p_temp} + ${#p_tchars} ) < ${maxlength} )); then
+ p_done=${p_temp}
+ else
break
fi
- p_last="${p_temp}"
done
+ path_prompt=${p_tchars}${p_done}
fi
;;
esac
-
- path_prompt="${p_done}"
PS1="$base_prompt$path_prompt %# $post_prompt"
PS2="$base_prompt$path_prompt %_> $post_prompt"
PS3="$base_prompt$path_prompt ?# $post_prompt"
}
--
This mail was generated by DokuWiki at
http://zshwiki.org/home/
A page in your DokuWiki was added or changed. Here are the details:
Date : 2008/04/05 00:29
Browser : @BROWSER@
IP-Address : @IPADDRESS@
Hostname : @HOSTNAME@
Old Revision: http://zshwiki.org/home/test?rev=1207235781
New Revision: http://zshwiki.org/home/test
Edit Summary:
User : asyd
@@ -1,3 +1,3 @@
test
- ''for i in *; echo $i''
+
--
This mail was generated by DokuWiki at
http://zshwiki.org/home/
A page in your DokuWiki was added or changed. Here are the details:
Date : 2008/04/05 00:03
Browser : Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b5) Gecko/2008040407 (Gentoo) Firefox/3.0b5
IP-Address : 87.0.139.111
Hostname : host111-139-dynamic.0-87-r.retail.telecomitalia.it
Old Revision: http://zshwiki.org/home/config/prompt?rev=1191491386
New Revision: http://zshwiki.org/home/config/prompt
Edit Summary: Add an example prompt theme.
User : creidiki
@@ -57,4 +57,142 @@
</code>
Simple enough, isn't it?
+ ==== Prompt Examples ====
+
+ Some examples of what you can do with zsh prompts.
+
+ Using styles to make flexible prompts:
+ <code>
+ prompt_soor_help () {
+ cat <<'EOF'
+ This prompt is configurable via styles:
+
+ Context: :prompt:soor
+
+ Colors (in zsh/terminfo value):
+ user-color - the color for user@host. defaults to 'green'
+ root-color - the color for the hostname for root. defaults to 'red'
+ prompt-color - the color for everything else. defaults to 'blue'
+
+ Path type:
+ path - possible values:
+ ratio - use COLUMNS/ratio to clip the path. Default.
+ fixed - use a fixed maximum lenght.
+ subdir - clip by number of subdirectories.
+ full - show the full path
+
+ Path lenght styles:
+ ratio - the ratio for the 'ratio' path style, funnily enough.
+ default to 6.
+ length - the maximin lenght for the 'fixed' path style.
+ defaults to 20
+ subdir - the number of subdirs to show for the 'subdir' path style.
+ defaults to 3.
+
+ You can set styles in the current terminal to test things out, values
+ will be updated.
+
+ EOF
+ }
+
+ prompt_soor_setup () {
+ setopt noxtrace localoptions
+
+ precmd () {
+
+ local p_full
+ local p_tchars p_temp p_done p_last
+ local maxlength ratio
+ local prompt_color
+ local user_color
+ local root_color
+ local path_style
+
+ zstyle -s :prompt:soor prompt-color prompt_color
+ prompt_color=${prompt_color:-'blue'}
+ zstyle -s :prompt:soor user-color user_color
+ user_color=${user_color:-'green'}
+ zstyle -s :prompt:soor root-color root_color
+ root_color=${root_color:-'red'}
+
+ [[ -z $(functions zsh/terminfo) ]] && autoload -Uz zsh/terminfo
+
+ if [[ "$terminfo[colors]" -ge 8 ]]; then
+ if [[ "$EUID" = "0" ]] || [[ "$USER" = 'root' ]]
+ then
+ base_prompt="%{$fg_bold[$root_color]%}%m%{$fg_bold[$prompt_color]%} "
+ else
+ base_prompt="%{$fg_bold[$user_color]%}%n@%m%{$fg_bold[$prompt_color]%} "
+ fi
+ post_prompt="%{$reset_color%}"
+ else
+ base_prompt="%n@%m "
+ post_prompt=""
+ fi
+
+ if zstyle -t :prompt:soor path full ratio fixed subdir; then
+ zstyle -s :prompt:soor path path_style
+ else
+ path_style='ratio'
+ fi
+
+ case "${path_style}" in
+ ratio)
+ zstyle -s :prompt:soor ratio ratio
+ ratio=${ratio:-6}
+ maxlength=$(($COLUMNS/$ratio))
+ ;;
+ fixed)
+ zstyle -s :prompt:soor length maxlength
+ maxlength=${maxlength:-20}
+ ;;
+ subdir)
+ zstyle -s :prompt:soor subdir maxlength
+ maxlength=${maxlength:-3}
+ ;;
+ esac
+
+ case "${path_style}" in
+ full)
+ p_done="%~"
+ ;;
+ subdir)
+ p_done=$(print -P "%(4~|..|)%${maxlength}~")
+ ;;
+ ratio|fixed)
+ p_full=$(print -P %~)
+ if [[ ${#p_full} -le ${maxlength} ]]; then
+ p_done="${p_full}"
+ else
+ # I don't actually remember how this little snippet works.
+ # But it /does/, somehow, so I'm not touching it.
+ p_tchars='../'
+ for (( i=1 ; ; ++i )); do
+ p_temp="${p_tchars}$(print -P %${i}~)"
+ if [[ ${#p_temp} -gt ${maxlength} ]]; then
+ if [[ -n ${p_last} ]]; then
+ p_done="${p_last}"
+ else
+ p_done="${p_temp}"
+ fi
+ break
+ fi
+ p_last="${p_temp}"
+ done
+ fi
+ ;;
+ esac
+
+
+ path_prompt="${p_done}"
+ PS1="$base_prompt$path_prompt %# $post_prompt"
+ PS2="$base_prompt$path_prompt %_> $post_prompt"
+ PS3="$base_prompt$path_prompt ?# $post_prompt"
+ }
+
+ preexec () { }
+ }
+
+ prompt_soor_setup
+ </code>
--
This mail was generated by DokuWiki at
http://zshwiki.org/home/
Bonjour,
au cas ou, il existe maintenant irc://#zsh-fr@irc.freenode.net/ en
espérant attendre une certaine masse critique ;p
a+
--
http://asyd.net/home/ - Home Page
http://guses.org/home/ - French Speaking (Open)Solaris User Group
A page in your DokuWiki was added or changed. Here are the details:
Date : 2008/04/03 17:16
Browser : Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.13) Gecko/20080311 Iceweasel/2.0.0.13 (Debian-2.0.0.13-0etch1)
IP-Address : 193.55.128.7
Hostname : pluto.info.unicaen.fr
Old Revision: http://zshwiki.org/home/test?rev=1207232086
New Revision: http://zshwiki.org/home/test
Edit Summary:
User : laynef
@@ -1 +1,3 @@
test
+
+ ''for i in *; echo $i''
--
This mail was generated by DokuWiki at
http://zshwiki.org/home/
A page in your DokuWiki was added or changed. Here are the details:
Date : 2008/04/03 17:07
Browser : ELinks/0.11.2 (textmode; FreeBSD 7.0-STABLE i386; 80x24-2)
IP-Address : 82.245.249.89
Hostname : stc92-3-82-245-249-89.fbx.proxad.net
Old Revision: http://zshwiki.org/home/builtin/modules/zpty?rev=1207231392
New Revision: http://zshwiki.org/home/builtin/modules/zpty
Edit Summary:
User : bapt
@@ -1,5 +1,5 @@
- zpty is a module that allow to create a virtual tty which can be written et read from the script. allowing to deal with command that refuses to get entry from a pipe : smbpasswd, ssh, scp.
+ zpty is a module that allow to create a virtual tty which can be written and read from the script. allowing to deal with command that refuses to get entry from a pipe : smbpasswd, ssh, scp.
to load
<code>
zmodload zsh/zpty
--
This mail was generated by DokuWiki at
http://zshwiki.org/home/