<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Another Home Page Blog - vim</title><link href="https://blog.anotherhomepage.org/" rel="alternate"></link><link href="https://blog.anotherhomepage.org/feed/tag/vim/atom" rel="self"></link><id>https://blog.anotherhomepage.org/</id><updated>2022-12-02T22:45:00+01:00</updated><entry><title>Dotfiles at scale</title><link href="https://blog.anotherhomepage.org/post/2022/12/02/dotfiles-at-scale/" rel="alternate"></link><published>2022-12-02T22:45:00+01:00</published><updated>2022-12-02T22:45:00+01:00</updated><author><name>Nils Ratusznik</name></author><id>tag:blog.anotherhomepage.org,2022-12-02:/post/2022/12/02/dotfiles-at-scale/</id><summary type="html">&lt;p&gt;&lt;img alt="a big crowd walking in the same direction" src="https://blog.anotherhomepage.org/images/2022/12/rob-curran-sUXXO3xPBYo-unsplash_mini.jpg"&gt;
Like everyone, I now store configuration files and customizations for my
beloved shell environment in a git repository.&lt;/p&gt;
&lt;h2&gt;Why ?&lt;/h2&gt;
&lt;p&gt;I have to admit, I'm no minimalist when it comes to computers. Without counting
my work-provided laptop, I use two laptops, one desktop, a few servers and
that's without mentioning what's …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="a big crowd walking in the same direction" src="https://blog.anotherhomepage.org/images/2022/12/rob-curran-sUXXO3xPBYo-unsplash_mini.jpg"&gt;
Like everyone, I now store configuration files and customizations for my
beloved shell environment in a git repository.&lt;/p&gt;
&lt;h2&gt;Why ?&lt;/h2&gt;
&lt;p&gt;I have to admit, I'm no minimalist when it comes to computers. Without counting
my work-provided laptop, I use two laptops, one desktop, a few servers and
that's without mentioning what's in the cloud, or the gadgets (e.g. PineBook
and Raspberry Pi) . Each and every one of these systems run a Unix-based 
operating system, either GNU/Linux, macOS or NetBSD.&lt;/p&gt;
&lt;p&gt;What these operating systems have in common is a command-line interface, or a
shell. And with time, I learned to tweak it and add a lot of small tools that
helps me in my various actions.&lt;/p&gt;
&lt;p&gt;Multiple systems, but same configuration. You know where I'm getting, don´t you
? Why would I do it by hand ?&lt;/p&gt;
&lt;h2&gt;How ?&lt;/h2&gt;
&lt;p&gt;The first reflex when it comes to quickly give several systems the same
configuration is to copy the same file on each of them. Then, I figured I could
pull the file to a central location, and push new versions to that location.
That reasoning leads to one key concept everyone already guessed : version
control system. So yes, I created 
&lt;a href="https://github.com/ahpnils/dotfiles"&gt;a git repository&lt;/a&gt;. I even ended up
renaming it to the same as everyone else : dotfiles. &lt;/p&gt;
&lt;h2&gt;Challenges ?&lt;/h2&gt;
&lt;p&gt;That kind of setup brings 3 challenges. The first one is how to organize the
files in the repository ? To me, the easiest way is to create a directory for
each tool, and give the configuration files the same names they would have in
their target system. Quick example : in my repository, my VIM configuration
file is &lt;code&gt;vim/.vimrc&lt;/code&gt;, and it will be used in &lt;code&gt;~/.vimrc&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The second challenge is how to install the files ? I though about copying them
from the repository, but it means I have to run an "install" phase each time I
update my repository. I decided to opt for symbolic links. That way, I don't
have to run an "install" phase for each update, just for the initial set up.
One major advantage I also find is that I can modify the files straight from
their supposed location. I can then spot the differences, and be reminded to
commit them if I &lt;code&gt;git pull -r&lt;/code&gt; after that.&lt;/p&gt;
&lt;p&gt;The third challenge is automation. I don't want to have to manually copy the
files (or in my case, symlink them). I know 
&lt;a href="https://github.com/geerlingguy"&gt;some people&lt;/a&gt; make heavy use of Ansible even to
&lt;a href="https://github.com/geerlingguy/mac-dev-playbook"&gt;set up their desktop
environment&lt;/a&gt;. I'm not there.
Yet. To me, starting with installing Ansible is not lightweight, so for now I
decided to stick with a good old &lt;a href="https://github.com/ahpnils/dotfiles/blob/master/Makefile"&gt;Makefile&lt;/a&gt;. 
I declared an &lt;code&gt;install&lt;/code&gt; target, which creates the symbolic links, a
&lt;code&gt;pkgin-deps&lt;/code&gt; target for installing useful softwares (on NetBSD and macOS), and
finally &lt;code&gt;rpm-deps&lt;/code&gt; for installing the same softwares (and more) on Fedora, my
distribution of choice. &lt;/p&gt;
&lt;h2&gt;What's next ?&lt;/h2&gt;
&lt;p&gt;This seems already complete, but as it turns out, there are more challenges to
overcome :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I may use another Linux distro (Alpine, Debian, and sometimes even Ubuntu) ;&lt;/li&gt;
&lt;li&gt;some commands do not behave the same depending on the operating system : my
  latest issue is with &lt;code&gt;which&lt;/code&gt;, which does not have some GNU options on NetBSD ;&lt;/li&gt;
&lt;li&gt;I would like to also configure some graphical parts of the desktop : I'll be
  soon digging in the commands to configure Gnome and macOS !&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I hope you enjoyed this post ! If you did, please share it on your favorite 
social networks :-)&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@curranrob?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Rob Curran&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/crowd?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;</content><category term="miscellaneous"></category><category term="linux"></category><category term="netbsd"></category><category term="macOS"></category><category term="bash"></category><category term="vim"></category><category term="git"></category><category term="make"></category><category term="makefile"></category><category term="dotfiles"></category><category term="blogmas"></category><category term="blogmas2022"></category></entry><entry><title>Couleurs dans le terminal</title><link href="https://blog.anotherhomepage.org/post/2011/12/05/couleurs-dans-le-terminal/" rel="alternate"></link><published>2011-12-05T08:40:00+01:00</published><updated>2011-12-05T08:40:00+01:00</updated><author><name>Nils Ratusznik</name></author><id>tag:blog.anotherhomepage.org,2011-12-05:/post/2011/12/05/couleurs-dans-le-terminal/</id><summary type="html">&lt;p&gt;Pour beaucoup de gens, la vue d'un terminal, en général en texte blanc sur fond noir (mais aussi en noir sur fond blanc ou beige sur certaines distributions), peut s'avérer très peu attrayante. En ce qui me concerne je me suis accommodé et j'ai fini par apprécier le terminal, grâce …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Pour beaucoup de gens, la vue d'un terminal, en général en texte blanc sur fond noir (mais aussi en noir sur fond blanc ou beige sur certaines distributions), peut s'avérer très peu attrayante. En ce qui me concerne je me suis accommodé et j'ai fini par apprécier le terminal, grâce à quelques modifications cosmétiques apportant de la couleur. Je trouve ainsi mon environnement beaucoup plus lisible.&lt;/p&gt;
&lt;h2&gt;Le prompt&lt;/h2&gt;
&lt;p&gt;Dans bash (et probablement dans d'autres shells), il est possible de modifier l'apparence du prompt via la variable d'environnement &lt;em&gt;PS1&lt;/em&gt;. Regardons quelle est la valeur de PS1 sur un système CentOS (les simples quotes visent à montrer qu'il y a un espace à la fin) :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;root@orgrimmar ~&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;PS1 vaut: &amp;#39;$PS1&amp;#39;&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;PS1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;vaut&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[\\u@\\h \\W]\\$ &amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Il est possible d'en modifier l'apparence avec de nombreux paramètres, tels que la couleur, certaines informations. Par exemple, j'ai choisi d'appliquer la personnalisation suivante sur tous mes environnements bash :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;nils&lt;/span&gt;&lt;span class="nv"&gt;@arreat&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;PS1 vaut: &amp;#39;$PS1&amp;#39;&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;PS1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;vaut&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;\\[\\]\\u\\[\\]@\\[\\]\\h\\[\\]:\\w\\[\\]\\$\\[\\] &amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ce qui est gênant, c'est que si ma variable d'environnement possède des couleurs, leurs codes ne sont pas affichés mais directement interprétés. En réalité, ma variable PS1 vaut :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# récupartion depuis mon bashrc :
PS1=$&amp;#39;\\[\\E[01;32m\\]\\u\\[\\E[0m\\]@\\[\\E[01;36m\\]\\h\\[\\E[0m\\]:\\w\\[\\E[01;32m\\]\\$\\[\\E[0m\\] &amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Le nom d'utilisateur et le signe "\$" sont verts, tandis que le nom d'hôte est bleu. J'ai réalisé une variante pour l'utilisateur root où le vert est remplacé par du rouge.&lt;/p&gt;
&lt;p&gt;Pour essayer, rien de plus simple : il suffit d'exporter la variable d'environnement PS1 avec une nouvelle valeur :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;root@orgrimmar ~&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;PS1 vaut: &amp;#39;$PS1&amp;#39;&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;PS1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;vaut&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;[\\u@\\h \\W]\\$ &amp;#39;&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;root@orgrimmar ~&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PS1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;\\[\\E[01;32m\\]\\u\\[\\E[0m\\]@\\[\\E[01;36m\\]\\h\\[\\E[0m\\]:\\w\\[\\E[01;32m\\]\\$\\[\\E[0m\\] &amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="nv"&gt;@orgrimmar&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;PS1 vaut: &amp;#39;$PS1&amp;#39;&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;PS1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;vaut&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;\\[\\]\\u\\[\\]@\\[\\]\\h\\[\\]:\\w\\[\\]\\$\\[\\] &amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Il est possible d'aller plus loin, comme de remplacer \\h par \\H pour obtenir le nom complet de la machine, d'insérer la date, d'afficher le prompt en gras... Vous trouverez chez &lt;a href="http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/" title="Nixcraft"&gt;Nixcraft&lt;/a&gt; les différents codes pour démarrer et stopper une couleur, ainsi que pour la mise en gras.&lt;/p&gt;
&lt;p&gt;Si vos expérimentations amènent un résultat peu plaisant, deux possibilités : la première consiste à appliquer de nouveau l'ancienne valeur PS1, si vous avez copié son contenu ailleurs, ou d'aller le chercher par exemple dans /etc/bashrc ; la deuxième consiste tout simplement à fermer puis relancer votre terminal.&lt;/p&gt;
&lt;p&gt;Une fois que votre nouveau prompt vous plaît, vous voulez rendre le changement définitif. Il est possible d'éditer son fichier &lt;em&gt;.bashrc&lt;/em&gt;, &lt;em&gt;.bash_profile&lt;/em&gt; ou &lt;em&gt;.profile&lt;/em&gt; pour cela. Si vous souhaitez que ce changement soit effectif pour tous les utilisateurs, il est possible de modifier directement &lt;em&gt;/etc/profile&lt;/em&gt; ou &lt;em&gt;/etc/bashrc&lt;/em&gt;, mais je ne vous le recommande pas : il est possible de mal éditer le fichier et de supprimer accidentellement des commandes utiles, et donc de mettre en vrac son système.&lt;/p&gt;
&lt;p&gt;Pour CentOS/RHEL/Fedora, j'ai pris l'habitude de créer un fichier nommé &lt;em&gt;/etc/profile.d/prompt.sh&lt;/em&gt; : en effet, le fichier &lt;em&gt;/etc/profile&lt;/em&gt; de ces distributions charge tous les .sh situés dans &lt;em&gt;/etc/profile.d&lt;/em&gt;. Il devient donc aisé d'ajouter ou de retirer des personnalisations shell comme des alias, le prompt, et d'autres variables d'environnement qui affecteront tous les utilisateurs.&lt;/p&gt;
&lt;p&gt;Pour NetBSD, j'ai choisi de créer un fichier &lt;em&gt;/usr/pkg/etc/bashrc&lt;/em&gt; contenant ces personnalisations, et d'ajouter le contenu suivant dans &lt;em&gt;/etc/profile&lt;/em&gt; (qui, par défaut, ne contient que des commentaires) :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;if&lt;span class="w"&gt; &lt;/span&gt;[&lt;span class="w"&gt; &lt;/span&gt;&amp;quot;&lt;span class="cp"&gt;${&lt;/span&gt;&lt;span class="n"&gt;BASH_no&lt;/span&gt;&lt;span class="cp"&gt;}&lt;/span&gt;&amp;quot;&lt;span class="w"&gt; &lt;/span&gt;!=&lt;span class="w"&gt; &lt;/span&gt;&amp;quot;no&amp;quot;&lt;span class="w"&gt; &lt;/span&gt;];&lt;span class="w"&gt; &lt;/span&gt;then
&lt;span class="w"&gt;                 &lt;/span&gt;[&lt;span class="w"&gt; &lt;/span&gt;-r&lt;span class="w"&gt; &lt;/span&gt;/usr/pkg/etc/bashrc&lt;span class="w"&gt; &lt;/span&gt;]&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;.&lt;span class="w"&gt; &lt;/span&gt;/usr/pkg/etc/bashrc
fi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;De la couleur dans ls&lt;/h2&gt;
&lt;p&gt;Selon votre système, cette option peut ne pas être disponible : cela fonctionne avec CentOS 4 et 5, mais pas avec NetBSD. Il s'agit tout simplement d'utiliser l'option &lt;em&gt;--color&lt;/em&gt;, qui peut être complétée, par exemple &lt;em&gt;--color=auto&lt;/em&gt; ou &lt;em&gt;--color=tty&lt;/em&gt;. D'où viennent ces couleurs ? De la variable d'environnement LS_COLORS. On peut donc modifier cette variable pour afficher les couleurs différemment, et consulter la page de manuel de &lt;a href="http://pwet.fr/man/linux/commandes/dircolors" title="dircolors"&gt;dircolors&lt;/a&gt; pour plus de détails.&lt;/p&gt;
&lt;h2&gt;Grep&lt;/h2&gt;
&lt;p&gt;La commande &lt;em&gt;grep&lt;/em&gt; possède une option &lt;em&gt;--color&lt;/em&gt;, parfois activée par défaut dans un alias sur certaines distributions. Elle colore en rouge la chaîne de caractères recherchée, que ce soit sous CentOS ou NetBSD.&lt;/p&gt;
&lt;h2&gt;Pages de manuel en couleur&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;most&lt;/em&gt; permet de visualiser un texte, comme &lt;em&gt;more&lt;/em&gt; ou &lt;em&gt;less&lt;/em&gt;. A la différence de ces deux derniers, &lt;em&gt;most&lt;/em&gt; affiche les pages de manuel en couleur. Pour cela, vous pouvez utiliser la commande suivante :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;PAGER=most man &amp;lt;votrecommande&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Pour que ce soit définitif, exportez la variable d'environnement &lt;em&gt;PAGER=most&lt;/em&gt;. Attention toutefois, vérifiez que vous n'avez pas un &lt;em&gt;PAGER=more&lt;/em&gt; qui traîne quelque part. Concernant la disponibilité du package, on peut le trouver dans &lt;a href="http://pkgsrc.se/misc/most" title="&amp;quot;most"&gt;pkgsrc&lt;/a&gt; ainsi que dans &lt;a href="http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/" title="&amp;quot;most"&gt;RPMForge&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Colorer ses fichiers de log&lt;/h2&gt;
&lt;p&gt;Un outil très pratique pour avoir des fichiers de log en couleurs est &lt;a href="http://freecode.com/projects/ccze" title="ccze"&gt;ccze&lt;/a&gt;. Il m'arrive de l'utiliser de la manière suivante :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;tail -f /chemin/vers/mon/log/apache | ccze
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Je peux aussi m'en servir sur un fichier qui n'est pas mis à jour en direct, en duo avec less :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;ccze -A &amp;lt; monfichierdelog | less -R
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ce petit bijou connaît de nombreux formats de fichiers de log, et les rend du coup plus agréables à lire. C'est disponible dans &lt;a href="http://pkgsrc.se/sysutils/ccze" title="&amp;quot;ccze"&gt;pkgsrc&lt;/a&gt; et dans &lt;a href="http://download.fedora.redhat.com/pub/epel/6/x86_64/repoview/ccze.html" title="&amp;quot;ccze"&gt;EPEL&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Un top en couleur ?&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://htop.sourceforge.net/" title="htop"&gt;Htop&lt;/a&gt; est une version “améliorée” de top qui, en plus d'afficher la couleur, affiche les taux d'occupation processeur et mémoire d'une manière un peu “graphique”. A noter cependant que cet outil est d'abord développé pour Linux, et qu'il faut, sous NetBSD, monter &lt;em&gt;/proc&lt;/em&gt; avec l'option “linux” (celle-ci est cependant différente de la couche de compatibilité binaire linux). Htop est disponible dans &lt;a href="http://pkgsrc.se/sysutils/htop" title="&amp;quot;htop"&gt;pkgsrc&lt;/a&gt; et dans &lt;a href="http://download.fedora.redhat.com/pub/epel/6/x86_64/repoview/htop.html" title="&amp;quot;htop"&gt;EPEL&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Coloration syntaxique avec VIm&lt;/h2&gt;
&lt;p&gt;Vous trouvez &lt;em&gt;vi&lt;/em&gt; trop morne et déprimant ? Installez &lt;a href="http://www.vim.org/" title="VIm"&gt;VIm&lt;/a&gt; et activez la coloration syntaxique ! Souvent, seul &lt;em&gt;vi&lt;/em&gt; est installé. Côté pkgsrc, le package se nomme &lt;a href="http://pkgsrc.se/editors/vim" title="&amp;quot;vim"&gt;vim&lt;/a&gt; et a pour dépendance &lt;a href="http://pkgsrc.se/editors/vim-share" title="&amp;quot;vim-share"&gt;vim-share&lt;/a&gt;. Côté Red Hat, on installera &lt;em&gt;vim-enhanced&lt;/em&gt; (dispo dans les dépôts de base). Une fois ceci fait, ajoutez dans votre répertoire &lt;em&gt;home&lt;/em&gt; un fichier .vimrc contenant au moins :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;syn on
set nu
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ensuite, éditez un script shell, par exemple. Vous verrez la couleur et les numéros de ligne. Pour ceux qui comme moi on un fond noir ou sombre, on ajoutera la directive suivante à son &lt;em&gt;.vimrc&lt;/em&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;set bg=dark
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;La coloration syntaxique s'adaptera ainsi au fond de votre terminal.&lt;/p&gt;
&lt;p&gt;Et voilà ! C'est Noël sur votre shell :-)&lt;/p&gt;
&lt;h2&gt;Commentaires&lt;/h2&gt;
&lt;h3&gt;Le 13/12/2011 11:49 par &lt;a href="http://daemontux.org"&gt;Zanko&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;On peut avoir la couleur directement sous less avec quelques variables d’environnement, du style :
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;38;5;33m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[01;31;5;31m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[38;5;31m' # begin underline&lt;/p&gt;</content><category term="Logiciels libres"></category><category term="ccze"></category><category term="CentOS"></category><category term="dircolors"></category><category term="htop"></category><category term="most"></category><category term="NetBSD"></category><category term="PS1"></category><category term="vim"></category></entry></feed>