1
0
Bifurcation 0
miroir de https://github.com/PAPAMICA/Wiki-Tech.io.git synchronisé 2024-07-04 09:09:19 +02:00
Wiki-Tech.io/Linux/Editeur-de-texte.html
2021-05-20 15:12:13 +00:00

384 lignes
20 Kio
HTML

<!--
title: Linux - Les éditeurs de textes
description: Comprendre et utiliser les éditeurs de textes comme VIM, Nano, Joe, etc..
published: true
date: 2021-05-20T14:34:37.932Z
tags:
editor: ckeditor
dateCreated: 2021-05-08T08:42:34.594Z
-->
<figure class="image image_resized" style="width:20.24%;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/Vimlogo.svg/1200px-Vimlogo.svg.png" alt="Vim — Wikipédia"></figure>
<h1>VIM</h1>
<h2>Présentation</h2>
<p>Vim est un éditeur de texte, c’est-à-dire un logiciel permettant la manipulation de fichiers texte. Il est directement inspiré de vi, dont il est le clone le plus populaire. Son nom signifie d’ailleurs Vi IMproved, que l’on peut traduire par « VI aMélioré »</p>
<h2>Manipulation de base</h2>
<figure class="table">
<table>
<thead>
<tr>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commande</th>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:w</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Sauvegarder le fichier</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:x ou :wq</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Enregistrer et quitter</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:q</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Quitter si aucun changement n'a été effectué</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:q!</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Quitter et annuler les changements</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:set nu</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Afficher le numéro des lignes</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:r <i>fichier</i></code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Importer un <i>fichier</i> dans le fichier actuel</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:<strong>n</strong> r <i>fichier</i></code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Importer un <i>fichier</i> dans le fichier actuel à partir de la ligne <strong>n</strong></td>
</tr>
</tbody>
</table>
</figure>
<p>&nbsp;</p>
<h2>Suppression</h2>
<figure class="table">
<table>
<thead>
<tr>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commande</th>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>x</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Supprimer un caractère unique (celui sur lequel est positionné le curseur</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>X</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Supprimer le caractère derrière le curseur</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>D</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Supprimer le reste de la ligne à partir du curseur</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>dd</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Supprimer une ligne entière</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code><strong>n</strong>dw</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Supprimer les prochains <strong>n</strong> mots</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code><strong>n</strong>dd</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Supprimer les <strong>n</strong> prochaines lignes</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:<strong>x</strong>,<strong>y</strong>d</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Supprimer depuis la ligne <strong>x</strong> à la ligne <strong>y</strong></td>
</tr>
</tbody>
</table>
</figure>
<p>&nbsp;</p>
<h2>Entrer en mode insertion (modification)</h2>
<figure class="table">
<table>
<thead>
<tr>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commande</th>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>i</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Insérer sur le curseur</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>a</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Insérer après le curseur</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>I</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Insérer sur la ligne suivante</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>A</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Insérer sur la ligne précédente</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>o</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Insérer une nouvelle ligne après la ligne actuelle</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>O</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Insérer une ligne avant la ligne actuelle</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code><strong>ESC</strong></code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Quitter le mode d'insertion</td>
</tr>
</tbody>
</table>
</figure>
<p>&nbsp;</p>
<h2>Copier Coller</h2>
<figure class="table">
<table>
<thead>
<tr>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commande</th>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>p</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Coller le contenu du presse papier en dessus de la ligne</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>P</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Coller le contenu du presse papier au dessus de la ligne</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>yy</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Copier une ligne</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>yw</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Copier un mot</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>y$</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Copier depuis la position du curseur jusqu'à la fin de la ligne</td>
</tr>
</tbody>
</table>
</figure>
<p>&nbsp;</p>
<h2>Rechercher et remplacer</h2>
<figure class="table">
<table>
<thead>
<tr>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commande</th>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>/<i>mot souhaité</i></code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Rechercher le <i>mot souhaité</i> après la position du curseur</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>?<i>mot souhaité</i></code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Rechercher le <i>mot souhaité</i> avant la position du curseur</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>n</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Trouver la prochaine occurrence du <i>mot souhaité</i></td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>N</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Trouver l'occurrence précédente</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>:%s/<i>ancien mot</i>/<i>nouveau mot</i>/g</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Remplacer toutes les occurrences de l'<i>ancien mot</i> par le <i>nouveau mot</i></td>
</tr>
</tbody>
</table>
</figure>
<p>&nbsp;</p>
<h2>Se déplacer</h2>
<figure class="table">
<table>
<thead>
<tr>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commande</th>
<th style="border-bottom:2px solid rgb(158, 158, 158);padding:0.75rem;">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>h</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer de 1 caractère à gauche</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>j</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer de 1 caractère en bas</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>k</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer de 1 caractère en haut</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>l</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer de 1 caractère à droite</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>w</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer au mot suivant</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>b</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer au début du mot</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>e</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer à la fin du mot</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>(</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer au début d'une phrase</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>)</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer à la fin d'une phrase</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>{</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer au paragraphe précédent</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>}</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer au paragraphe suivant</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>^</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer au début de la ligne</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>$</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer à la fin de la ligne</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>&lt;<strong>n</strong>&gt;G</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer à la <strong>n</strong>ème line</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>G</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer à la dernière ligne</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>gg</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer à la première ligne</td>
</tr>
<tr>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;"><code>%</code></td>
<td style="border-bottom:1px solid rgb(238, 238, 238);padding:0.75rem;">Se déplacer à la parenthèse correspondante</td>
</tr>
</tbody>
</table>
</figure>
<p>&nbsp;</p>
<hr>
<figure class="image image_resized" style="width:17.13%;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/8a/Gnu-nano.svg/1200px-Gnu-nano.svg.png" alt="GNU nano — Wikipédia"></figure>
<h1>Nano</h1>
<h2>Présentation</h2>
<p>Ce petit éditeur est un clone libre de “pico” qui était inclus dans le logiciel de gestion de courrier “Pine”. Nano utilise la bibliothèque “ncurse” pour offrir une interface dite “semi-graphique” à l'intérieur d'une console. Ici pas de surenchère de fonctions, pas de raccourcis “à quatre mains”, juste ce qu'il faut pour éditer un fichier, y effectuer une recherche, c'est un outils simple et efficace pour le spécialiste, mais surtout c'est peut-être le seul éditeur de texte en console totalement accessible au grand débutant.</p>
<p>&nbsp;</p>
<h2>Utilisation basique</h2>
<figure class="table">
<table>
<thead>
<tr>
<th style="width:120px;">Commande</th>
<th style="height:24px;">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width:120px;"><code>CTRL + A</code></td>
<td style="height:24px;">Aller au début de la ligne.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + E</code></td>
<td style="height:24px;">Aller à la fin de la ligne.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + Y</code></td>
<td style="height:24px;">Faire défiler la page vers le bas.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + V</code></td>
<td style="height:24px;">Faire défiler la page vers le haut.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + G</code></td>
<td style="height:48px;">Cette commande ouvre une <strong>fenêtre d’aide</strong> qui contient des informations concernant toutes les commandes que vous pouvez utiliser avec l’éditeur Nano.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + O</code></td>
<td style="height:72px;">Pour sauvegarder votre fichier. Lorsque cette commande est utilisée, vous serez invité à modifier ou vérifier le nom de fichier souhaité et après avoir appuyé sur Entrée, elle enregistrera votre fichier.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + W</code></td>
<td style="height:72px;">Une des commandes les plus utiles. Elle est utilisée pour rechercher une expression spécifique dans votre texte. Elle fonctionne comme la commande <strong>CTRL + F</strong> sur d’autres applications. Pour rechercher la même expression, appuyez sur <strong>ALT + W</strong> autant de fois qu’il le faut.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + K</code></td>
<td style="height:24px;">Coupe toute la ligne sélectionnée dans le “<strong>presse-papier</strong>”.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + U</code></td>
<td style="height:24px;">Colle le texte du “presse-papier” dans la ligne sélectionnée.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + J</code></td>
<td style="height:24px;">Justifie le paragraphe actuel.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + C</code></td>
<td style="height:24px;">Affiche la position actuelle du curseur dans le texte (ligne / colonne / caractère).</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + X</code></td>
<td style="height:48px;">Quitte l’éditeur de texte Nano. Dans le cas où vous avez apporté des modifications au fichier, elle vous invite à sauvegarder.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + R</code></td>
<td style="height:48px;">Ouvre un fichier avec la commande «&nbsp;Lire le fichier&nbsp;». Insère le fichier depuis le disque/dossier à la position actuelle du curseur.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + \</code></td>
<td style="height:24px;">Remplace les mots spécifiés.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + T</code></td>
<td style="height:24px;">Met en route le correcteur orthographique si disponible.</td>
</tr>
<tr>
<td style="width:120px;"><code>CTRL + _</code></td>
<td style="height:24px;">Va au numéro de ligne et de colonne spécifié.</td>
</tr>
<tr>
<td style="width:120px;"><code>ALT + A</code></td>
<td style="height:48px;">Pour sélectionner un texte. Vous pouvez combiner cette commande avec <strong>CTRL + K</strong> pour couper une partie spécifique du texte.</td>
</tr>
</tbody>
</table>
</figure>
<p>&nbsp;</p>
<hr>
<h1>Joe</h1>
<h2>Présentation</h2>
<p>&nbsp;</p>
<h2>Utilisation</h2>