<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Actinux &#187; zlogin</title>
	<atom:link href="http://www.actinux.org/index.php/tag/zlogin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.actinux.org</link>
	<description>La réponse libre à un monde libre</description>
	<lastBuildDate>Thu, 26 Aug 2010 10:09:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Découverte de Zsh sur CentOS 5.2</title>
		<link>http://www.actinux.org/index.php/2009/04/03/zsh-sur-centos-52/</link>
		<comments>http://www.actinux.org/index.php/2009/04/03/zsh-sur-centos-52/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 10:31:28 +0000</pubDate>
		<dc:creator>ati</dc:creator>
				<category><![CDATA[Tutos]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[zlogin]]></category>
		<category><![CDATA[zlogout]]></category>
		<category><![CDATA[zprofile]]></category>
		<category><![CDATA[zsh]]></category>
		<category><![CDATA[zshrc]]></category>

		<guid isPermaLink="false">http://www.actinux.org/?p=59</guid>
		<description><![CDATA[Découvrons dans ce tutoriel ce qu&#8217;est Zsh et apprenons à le compiler et le configurer sous une CentOS 5.2

1. Petite présentation
Le Z shell ou zsh est un shell Unix. Il reprend la plupart des fonctions les plus pratiques de bash, ksh ou encore tcsh.
En particulier, Zsh apporte notamment les fonctionnalités suivantes :

 Complétion des commandes, des [...]]]></description>
			<content:encoded><![CDATA[<p>Découvrons dans ce tutoriel ce qu&#8217;est Zsh et apprenons à le compiler et le configurer sous une CentOS 5.2<br />
<span id="more-59"></span></p>
<p><strong>1. <span style="text-decoration: underline;">Petite présentation</span></strong><br />
Le Z shell ou zsh est un shell Unix. Il reprend la plupart des fonctions les plus pratiques de bash, ksh ou encore tcsh.<br />
En particulier, Zsh apporte notamment les fonctionnalités suivantes :</p>
<ul>
<li> Complétion des commandes, des options et des arguments de la plupart des commandes. En particulier, taper la suite de caractères « cd  » ne permettra la complétion que par des répertoires ;</li>
<li>Recherche dans les sous-répertoire grâce au sélecteur ** ;</li>
<li>Partage de l&#8217;historique des commandes entre tous les shells zsh actuellement actifs ;</li>
<li>Utilisation améliorée des variables et des tableaux ;</li>
<li>Édition des commandes multi lignes dans un seul buffer ;</li>
<li>Correction « orthographique » des commandes tapées</li>
<li>Plusieurs modes de compatibilité (zsh peut par exemple être vu comme un shell bourne quand il est exécuté en tant que /bin/sh) ;</li>
<li>Invite de commande personnalisable, avec la possibilité d&#8217;afficher des informations sur le côté droit de l&#8217;écran qui disparaissent si la commande tapée est trop longue ;</li>
</ul>
<p><strong>2. <span style="text-decoration: underline;">Compilation et installation</span></strong><br />
Plusieurs mirroirs sont disponibles pour récupérer les dernières versions du produit. Ils sont listés sur le site de Zsh : <a href="http://www.zsh.org/">http://www.zsh.org/</a><br />
Commençons donc ce tutoriel en récupérant la dernière version stable (à cette heure il s&#8217;agit de la version 4.2.3) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span><span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>nephtys.lip6.fr<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>unix<span style="color: #000000; font-weight: bold;">/</span>shells<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">zsh</span><span style="color: #000000; font-weight: bold;">/</span>zsh.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvf zsh-4.2.3.tar.gz
<span style="color: #c20cb9; font-weight: bold;">mv</span> zsh-4.2.3 <span style="color: #000000; font-weight: bold;">/</span>opt
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>zsh-4.2.3</pre></div></div>

<p>On installe un paquet nécessaire à sa compilation :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> ncurses-devel</pre></div></div>

<p>Nous pouvons désormais le compiler :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> check
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Par défaut, zsh s&#8217;installera dans le /usr/local/bin. Vous pouvez d’ores et déjà le lancer.</p>
<p><strong>3. <span style="text-decoration: underline;">Une config de base</span></strong><br />
Le shell Zsh comporte 2 paires de 5 fichiers de configuration. Vous les trouverez la première paire dans le /etc et la seconde dans votre répertoire personnel /home. Comme tous les shells, les fichiers de configuration globale (dans le /etc) seront lus en premier suivi par la lecture de vos fichiers personnels (dans le /home).<br />
Chronologiquement à leur ordre de lecture, ces fichiers sont :</p>
<ul>
<li><span style="text-decoration: underline;">zshenv et .zshenv</span> : contient l&#8217;ensemble des variables d&#8217;environnement ;</li>
<li><span style="text-decoration: underline;">zprofile et .zprofile</span> : est lu uniquement dans le cas d&#8217;un login shell ;</li>
<li><span style="text-decoration: underline;">zshrc et .zshrc</span> : (est lu uniquement dans le cas d&#8217;un interactive shell), il contient les aliases, les options (setopt), les fonctions, les zstyles&#8230; ;</li>
<li><span style="text-decoration: underline;">zlogin et .zlogin</span> : (est lu uniquement dans le cas d&#8217;un login shell), on y place des commandes à exécuter avant la session ;</li>
<li>En fermant votre shell les fichiers <span style="text-decoration: underline;">.zlogout et zlogout</span> sont lus dans l&#8217;ordre respectif (fichier utilisateur puis global).</li>
</ul>
<p>Apprenons désormais à configurer un minimum Zsh pour le rendre convivial et surtout pour profiter de son extrême efficacité et utilité <img src='http://www.actinux.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Voici donc quelques fichiers de configuration prêt à l&#8217;emploi.<br />
<em>Je tiens d&#8217;ailleurs à préciser que ces fichiers proviennent du site <strong>http://formation-debian.via.ecp.fr/</strong> et ont été légèrement modifiés. Je remercie la personne qui me l&#8217;a appris, même si la forme de sa remarque était autant inappropriée que stupide et qu&#8217;il n&#8217;a manifestement pas le goût de la présomption d&#8217;innocence&#8230;</em></p>
<p><span style="text-decoration: underline;"><strong>zshenv</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Formation Debian GNU/Linux par Alexis de Lattre</span>
<span style="color: #666666; font-style: italic;"># http://formation-debian.via.ecp.fr/</span>
<span style="color: #666666; font-style: italic;"># Modifié par le blog Actinux</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Le PATH = un ensemble de répertoires dans lequel le shell va chercher les commandes (on les sépare par des ':')</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;/usr/local/bin:/usr/local/sbin:/bin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/sbin:<span style="color: #007800;">$HOME</span>/bin&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Viewer/Editeur par défaut (pour Crontab, CVS,...)</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">VISUAL</span>=<span style="color: #c20cb9; font-weight: bold;">vim</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">EDITOR</span>=<span style="color: #c20cb9; font-weight: bold;">vim</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Permissions rw-r--r-- pour les fichiers crées</span>
<span style="color: #666666; font-style: italic;"># et rwxr-xr-x pour les répertoires crées</span>
<span style="color: #7a0874; font-weight: bold;">umask</span> 022
&nbsp;
<span style="color: #666666; font-style: italic;"># Proxy HTTP / FTP sans mot de passe</span>
<span style="color: #666666; font-style: italic;">#export http_proxy=&quot;http://proxy.exemple.org:8080&quot;</span>
<span style="color: #666666; font-style: italic;">#export ftp_proxy=&quot;ftp://proxy.exemple.org:8080&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Proxy HTTP / FTP avec mot de passe</span>
<span style="color: #666666; font-style: italic;">#export http_proxy=&quot;http://login:password@proxy.exemple.org:8080&quot;</span>
<span style="color: #666666; font-style: italic;">#export ftp_proxy=&quot;ftp://login:password@proxy.exemple.org:8080&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Ne pas passer par le proxy pour les domaines locaux</span>
<span style="color: #666666; font-style: italic;">#export no_proxy=&quot;exemple.org&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># De la couleur pour grep</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GREP_OPTIONS</span>=<span style="color: #ff0000;">'--color=auto'</span></pre></div></div>

<p><span style="text-decoration: underline;"><strong>zshlogin</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Formation Debian GNU/Linux par Alexis de Lattre</span>
<span style="color: #666666; font-style: italic;"># http://formation-debian.via.ecp.fr/</span>
<span style="color: #666666; font-style: italic;"># Modifié par le blog Actinux</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Ce fichier contient les commandes qui s'exécutent quand l'utilisateur</span>
<span style="color: #666666; font-style: italic;"># Ouvre une console</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Affiche des informations sur le système</span>
<span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-a</span>
<span style="color: #c20cb9; font-weight: bold;">uptime</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Accepte les messages d'autres utilisateurs</span>
<span style="color: #c20cb9; font-weight: bold;">mesg</span> y</pre></div></div>

<p><span style="text-decoration: underline;"><strong>zshlogout</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Formation Debian GNU/Linux par Alexis de Lattre</span>
<span style="color: #666666; font-style: italic;"># http://formation-debian.via.ecp.fr/</span>
<span style="color: #666666; font-style: italic;"># Modifié par le blog Actinux</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Ce fichier contient les commandes qui s'exécutent quand l'utilisateur</span>
<span style="color: #666666; font-style: italic;"># Ferme une console</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Nettoie l'écran</span>
<span style="color: #c20cb9; font-weight: bold;">clear</span></pre></div></div>

<p><span style="text-decoration: underline;"><strong>zshrc</strong></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Formation Debian GNU/Linux par Alexis de Lattre</span>
<span style="color: #666666; font-style: italic;"># http://formation-debian.via.ecp.fr/</span>
<span style="color: #666666; font-style: italic;"># Modifié par le blog Actinux</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># 1. Les alias</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#  Gestion du ls : couleur + touche pas aux accents</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">ls</span></span>=<span style="color: #ff0000;">'ls --classify --tabsize=0 --literal --color=auto --show-control-chars --human-readable'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Gestion du grep : couleur</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">grep</span></span>=<span style="color: #ff0000;">'grep --color=auto'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Demande confirmation avant d'écraser un fichier</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">cp</span></span>=<span style="color: #ff0000;">'cp --interactive'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">mv</span></span>=<span style="color: #ff0000;">'mv --interactive'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">rm</span></span>=<span style="color: #ff0000;">'rm --interactive'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Raccourcis pour 'ls'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ll</span>=<span style="color: #ff0000;">'ls -l'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">la</span>=<span style="color: #ff0000;">'ls -la'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Quelques alias pratiques</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">c</span>=<span style="color: #ff0000;">'clear'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">less</span></span>=<span style="color: #ff0000;">'less --quiet'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">s</span>=<span style="color: #ff0000;">'cd ..'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">df</span></span>=<span style="color: #ff0000;">'df --human-readable'</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">du</span></span>=<span style="color: #ff0000;">'du --human-readable'</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># 2. Prompt et définition des touches</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;linux&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;screen&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;screen-w&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
 bindkey <span style="color: #ff0000;">'^[[1~'</span> beginning-of-line       <span style="color: #666666; font-style: italic;"># Home</span>
 bindkey <span style="color: #ff0000;">'^[[4~'</span> end-of-line             <span style="color: #666666; font-style: italic;"># End</span>
 bindkey <span style="color: #ff0000;">'^[[3~'</span> delete-char             <span style="color: #666666; font-style: italic;"># Del</span>
 bindkey <span style="color: #ff0000;">'^[[2~'</span> overwrite-mode          <span style="color: #666666; font-style: italic;"># Insert</span>
 bindkey <span style="color: #ff0000;">'^[[5~'</span> history-search-backward <span style="color: #666666; font-style: italic;"># PgUp</span>
 bindkey <span style="color: #ff0000;">'^[[6~'</span> history-search-forward  <span style="color: #666666; font-style: italic;"># PgDn</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;xterm&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;xterm-color&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;xterm-debian&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$COLORTERM</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #660033;">-a</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$UNAME</span>&quot;</span> = <span style="color: #ff0000;">&quot;Linux&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
  <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">TERM</span>=xterm-debian
  <span style="color: #000000; font-weight: bold;">fi</span>
  bindkey <span style="color: #ff0000;">'^[[H'</span>  beginning-of-line       <span style="color: #666666; font-style: italic;"># Home</span>
  bindkey <span style="color: #ff0000;">'^[[F'</span>  end-of-line             <span style="color: #666666; font-style: italic;"># End</span>
  bindkey <span style="color: #ff0000;">'^[[3~'</span> delete-char             <span style="color: #666666; font-style: italic;"># Del</span>
  bindkey <span style="color: #ff0000;">'^[[2~'</span> overwrite-mode          <span style="color: #666666; font-style: italic;"># Insert</span>
  bindkey <span style="color: #ff0000;">'^[[5~'</span> history-search-backward <span style="color: #666666; font-style: italic;"># PgUp</span>
  bindkey <span style="color: #ff0000;">'^[[6~'</span> history-search-forward  <span style="color: #666666; font-style: italic;"># PgDn</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;rxvt&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">TERM</span>=<span style="color: #ff0000;">&quot;xterm&quot;</span>
  bindkey <span style="color: #ff0000;">'^[[1~'</span> beginning-of-line       <span style="color: #666666; font-style: italic;"># Home</span>
  bindkey <span style="color: #ff0000;">'^[[4~'</span> end-of-line             <span style="color: #666666; font-style: italic;"># End</span>
  bindkey <span style="color: #ff0000;">'^[[3~'</span> delete-char             <span style="color: #666666; font-style: italic;"># Del</span>
  bindkey <span style="color: #ff0000;">'^[[2~'</span> overwrite-mode          <span style="color: #666666; font-style: italic;"># Insert</span>
  bindkey <span style="color: #ff0000;">'^[[5~'</span> history-search-backward <span style="color: #666666; font-style: italic;"># PgUp</span>
  bindkey <span style="color: #ff0000;">'^[[6~'</span> history-search-forward  <span style="color: #666666; font-style: italic;"># PgDn</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-en</span> <span style="color: #ff0000;">'\033&amp;gt;'</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TERM</span>&quot;</span> = <span style="color: #ff0000;">&quot;vt100&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  bindkey <span style="color: #ff0000;">'^[OA'</span> up-line-or-history   <span style="color: #666666; font-style: italic;"># Fleche haut</span>
  bindkey <span style="color: #ff0000;">'^[OB'</span> down-line-or-history <span style="color: #666666; font-style: italic;"># Fleche bas</span>
  bindkey <span style="color: #ff0000;">'^[OC'</span> forward-char         <span style="color: #666666; font-style: italic;"># Fleche droite</span>
  bindkey <span style="color: #ff0000;">'^[OD'</span> backward-char        <span style="color: #666666; font-style: italic;"># Fleche gauche</span>
  bindkey <span style="color: #ff0000;">'^?'</span>   delete-char          <span style="color: #666666; font-style: italic;"># Del</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># On définit ici les couleurs du term pour le root ou les utilisateurs</span>
<span style="color: #007800;">BLACK</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[01;30m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">GREEN</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[01;32m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">RED</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[01;31m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">YELLOW</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[01;33m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">CYAN</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[36;1m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">BLUE</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[01;34m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">BOLD</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[01;39m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">NORM</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[00m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
<span style="color: #007800;">WHITE</span>=<span style="color: #ff0000;">&quot;%{&quot;</span>$<span style="color: #ff0000;">'\033[37;1m'</span><span style="color: #ff0000;">&quot;%}&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`id -u`</span>&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${CYAN}</span>%T <span style="color: #007800;">${BLUE}</span>%n<span style="color: #007800;">${YELLOW}</span>@<span style="color: #007800;">${WHITE}</span>%m <span style="color: #007800;">${GREEN}</span>%~<span style="color: #007800;">${YELLOW}</span> # <span style="color: #007800;">${NORM}</span><span style="color: #007800;">${BOLD}</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
  <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${CYAN}</span>%T <span style="color: #007800;">${RED}</span>%n<span style="color: #007800;">${YELLOW}</span>@<span style="color: #007800;">${WHITE}</span>%m <span style="color: #007800;">${GREEN}</span>%~<span style="color: #007800;">${YELLOW}</span> $ <span style="color: #007800;">${NORM}</span><span style="color: #007800;">${BOLD}</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Gestion de la couleur pour 'ls' (exportation de LS_COLORS)</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">dircolors</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-r</span> ~<span style="color: #000000; font-weight: bold;">/</span>.dir_colors <span style="color: #7a0874; font-weight: bold;">&#93;</span>
  <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`dircolors ~/.dir_colors`</span>&quot;</span>
  <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dir_colors <span style="color: #7a0874; font-weight: bold;">&#93;</span>
  <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`dircolors /etc/dir_colors`</span>&quot;</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`dircolors`</span>&quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># 3. Options de zsh (cf 'man zshoptions')</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Je ne veux JAMAIS de beeps</span>
unsetopt beep
unsetopt hist_beep
unsetopt list_beep
<span style="color: #666666; font-style: italic;"># &amp;gt;| doit etre utilise pour pouvoir ecraser un fichier déjà éxistant ;</span>
<span style="color: #666666; font-style: italic;"># le fichier ne sera pas écrasé avec '&amp;gt;'</span>
unsetopt clobber
<span style="color: #666666; font-style: italic;"># Ctrl+D est équivalent a 'logout'</span>
unsetopt ignore_eof
<span style="color: #666666; font-style: italic;"># Affiche le code de sortie si different de '0'</span>
setopt print_exit_value
<span style="color: #666666; font-style: italic;"># Demande confirmation pour 'rm *'</span>
unsetopt rm_star_silent
<span style="color: #666666; font-style: italic;"># Correction orthographique des commandes</span>
setopt correct
<span style="color: #666666; font-style: italic;"># Si on utilise des jokers dans une liste d'arguments, retire les jokers</span>
<span style="color: #666666; font-style: italic;"># qui ne correspondent a rien au lieu de donner une erreur</span>
setopt nullglob
&nbsp;
<span style="color: #666666; font-style: italic;"># Schémas de completion</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># - Schéma A :</span>
<span style="color: #666666; font-style: italic;"># 1ere tabulation : complète jusqu'au bout de la partie commune</span>
<span style="color: #666666; font-style: italic;"># 2eme tabulation : propose une liste de choix</span>
<span style="color: #666666; font-style: italic;"># 3eme tabulation : complète avec le 1er item de la liste</span>
<span style="color: #666666; font-style: italic;"># 4eme tabulation : complète avec le 2eme item de la liste, etc...</span>
<span style="color: #666666; font-style: italic;"># -&amp;gt; c'est le schema de complétion par défaut de zsh.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Schema B :</span>
<span style="color: #666666; font-style: italic;"># 1ere tabulation : propose une liste de choix et complète avec le 1er item</span>
<span style="color: #666666; font-style: italic;">#                   de la liste</span>
<span style="color: #666666; font-style: italic;"># 2eme tabulation : complète avec le 2eme item de la liste, etc...</span>
<span style="color: #666666; font-style: italic;"># Si vous voulez ce schéma, décommentez la ligne suivante :</span>
<span style="color: #666666; font-style: italic;">#setopt menu_complete</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Schema C :</span>
<span style="color: #666666; font-style: italic;"># 1ere tabulation : complète jusqu'au bout de la partie commune et</span>
<span style="color: #666666; font-style: italic;">#                   propose une liste de choix</span>
<span style="color: #666666; font-style: italic;"># 2eme tabulation : complète avec le 1er item de la liste</span>
<span style="color: #666666; font-style: italic;"># 3eme tabulation : complète avec le 2eme item de la liste, etc...</span>
<span style="color: #666666; font-style: italic;"># Ce schema est le meilleur a mon gout !</span>
<span style="color: #666666; font-style: italic;"># Si vous voulez ce schema, décommentez la ligne suivante :</span>
<span style="color: #666666; font-style: italic;">#unsetopt list_ambiguous</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Options de complétion</span>
<span style="color: #666666; font-style: italic;"># Quand le dernier caractère d'une complétion est '/' et que l'on</span>
<span style="color: #666666; font-style: italic;"># tape 'espace' après, le '/' est effacé</span>
setopt auto_remove_slash
<span style="color: #666666; font-style: italic;"># Ne fait pas de complétion sur les fichiers et répertoires cachés</span>
unsetopt glob_dots
&nbsp;
<span style="color: #666666; font-style: italic;"># Traite les liens symboliques comme il faut</span>
setopt chase_links
&nbsp;
<span style="color: #666666; font-style: italic;"># Quand l'utilisateur commence sa commande par '!' pour faire de la</span>
<span style="color: #666666; font-style: italic;"># complétion historique, il n'execute pas la commande immédiatement</span>
<span style="color: #666666; font-style: italic;"># mais il écrit la commande dans le prompt</span>
setopt hist_verify
<span style="color: #666666; font-style: italic;"># Si la commande est invalide mais correspond au nom d'un sous-répertoire</span>
<span style="color: #666666; font-style: italic;"># éxecuter 'cd sous-repertoire'</span>
setopt auto_cd
<span style="color: #666666; font-style: italic;"># L'execution de &quot;cd&quot; met le repertoire d'ou l'on vient sur la pile</span>
setopt auto_pushd
<span style="color: #666666; font-style: italic;"># Ignore les doublons dans la pile</span>
setopt pushd_ignore_dups
<span style="color: #666666; font-style: italic;"># N'affiche pas la pile apres un &quot;pushd&quot; ou &quot;popd&quot;</span>
setopt pushd_silent
<span style="color: #666666; font-style: italic;"># &quot;pushd&quot; sans argument = &quot;pushd $HOME&quot;</span>
setopt pushd_to_home
&nbsp;
<span style="color: #666666; font-style: italic;"># Les jobs qui tournent en tache de fond sont nice a '0'</span>
unsetopt bg_nice
<span style="color: #666666; font-style: italic;"># N'envoie pas de &quot;HUP&quot; aux jobs qui tournent quand le shell se ferme</span>
unsetopt hup
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># 4. Paramètres de l'historique des commandes</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Nombre d'entrées dans l'historique</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTORY</span>=<span style="color: #000000;">1000</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">SAVEHIST</span>=<span style="color: #000000;">1000</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Fichier où est stocké l'historique</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTFILE</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.zsh_history
&nbsp;
<span style="color: #666666; font-style: italic;"># Ajoute l'historique à la fin de l'ancien fichier</span>
setopt append_history
&nbsp;
<span style="color: #666666; font-style: italic;"># Chaque ligne est ajoutée dans l'historique à mesure qu'elle est tapée</span>
setopt inc_append_history
&nbsp;
<span style="color: #666666; font-style: italic;"># Ne stocke pas une ligne dans l'historique si elle est identique à la précédente</span>
unsetopt hist_ignore_dups
&nbsp;
<span style="color: #666666; font-style: italic;"># Supprime les répétitions dans le fichier d'historique, ne conservant que la dernière occurrence ajoutée</span>
unsetopt hist_ignore_all_dups
&nbsp;
<span style="color: #666666; font-style: italic;"># Supprime les répétitions dans l'historique lorsqu'il est plein, mais pas avant</span>
unsetopt hist_expire_dups_first
&nbsp;
<span style="color: #666666; font-style: italic;"># N'enregistre pas plus d'une fois une même ligne, quelles que soient les options fixées pour la session courante</span>
<span style="color: #666666; font-style: italic;">#setopt hist_save_no_dups</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># La recherche dans l'historique avec l'éditeur de commandes de zsh ne</span>
<span style="color: #666666; font-style: italic;"># montre  pas une même  ligne  plus d'une fois,  meme  si  elle a été</span>
<span style="color: #666666; font-style: italic;"># enregistrée</span>
unsetopt hist_find_no_dups
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># 5. Complétion des options des commandes</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
zstyle <span style="color: #ff0000;">':completion:*'</span> matcher-list <span style="color: #ff0000;">''</span> <span style="color: #ff0000;">'m:{a-z}={A-Z}'</span>
zstyle <span style="color: #ff0000;">':completion:*'</span> max-errors <span style="color: #000000;">3</span> numeric
zstyle <span style="color: #ff0000;">':completion:*'</span> use-compctl <span style="color: #c20cb9; font-weight: bold;">false</span>
&nbsp;
autoload <span style="color: #660033;">-U</span> compinit
compinit</pre></div></div>

<p>Je reviendrai plus en détail sur ces fichiers de configuration lors d&#8217;un prochain tutoriel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actinux.org/index.php/2009/04/03/zsh-sur-centos-52/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

