This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
vi [2011/12/28 16:43] 127.0.0.1 external edit |
vi [2013/01/30 17:52] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ComputerStuff > [[GnuLinux]] > [[EditerUnTexte]] | + | En console, j'utilise [[http://www.vim.org/|vim]], un clone libre de vi, pour [[editeruntexte|éditer un texte]]. |
- | En console, j'utilise quasi exclusivement ((http://www.vim.org/ vim)), qui est un clone libre de [[vi]]. | + | L'[[http://www.theregister.co.uk/2003/09/11/bill_joys_greatest_gift/| histoire de vi]]. |
- | L'((http://www.theregister.co.uk/2003/09/11/bill_joys_greatest_gift/ histoire de [[vi]])). | + | ====== Trucs ====== |
- | === Trucs == | + | * pour trouver l'accolade correspondante à celle sur laquelle le curseur se trouve, taper '%' |
+ | * pour indenter vers la droite, '>>'; pour indenter vers la gauche, '<<' | ||
+ | * pour remplacer depuis la position du curseur jusqu'à la fin du texte 'toto' par 'titi' : <code>:.,$s/toto/titi/</code> | ||
+ | * pour faire apparaitre la ligne de stats : ctrl+g | ||
+ | * pour sortir de vim: ctrl+z et on est de nouveau en ligne de commande; pour retourner dans vim, taper dans le shell<code>fg</code> | ||
+ | * pour avoir plusieurs fichiers à l'écran (cf. [[http://www.linux.com/archive/feed/54157| Vim tips: Using viewports]]) :<code>split /path/to/file</code> | ||
+ | * pour changer d'un fichier à l'autre : ctrl+w ctrl+w (2 fois) | ||
- | * pour trouver l'accolade correspondante à celle sur laquelle le curseur se trouve, taper '%' | + | ====== Fichiers de configuration ====== |
- | * pour indenter vers la droite, '>>'; pour indenter vers la gauche, '<<' | + | |
- | * pour remplacer depuis la position du curseur jusqu'à la fin du texte 'toto' par 'titi': :.,$s/toto/titi/ | + | |
- | * pour faire apparaître la ligne de stats: ctrl+g | + | |
- | * pour sortir de vim: ctrl+z et on est de nouveau en ligne de commande; pour retourner dans vim, taper dans le shell | + | |
- | <code>fg</code> | + | |
- | * pour avoir plusieurs fichiers à l'écran (cf. ((http://www.linux.com/archive/feed/54157 Vim tips: Using viewports))): | + | |
- | <code>split /path/to/file</code> | + | |
- | * pour changer d'un fichier à l'autre: ctrl+w ctrl+w (2 fois) | + | |
- | + | ||
- | === Fichiers de configuration == | + | |
.vimrc | .vimrc | ||
- | * pour avoir les couleurs: syntax on | + | * pour avoir les couleurs : syntax on |
- | * pour régler l'indentation à 2: set sw=2 | + | * pour régler l'indentation à 2 : set sw=2 |
- | * pour avoir un backspace convenable: set bs=2 | + | * pour avoir un backspace convenable : set bs=2 |
- | * pour ne pas imiter [[vi]]: set nocp | + | * pour ne pas imiter vi : set nocp |
- | * pour aller à la ligne (80 colonnes): set textwidth=80 (NB: à faire avant de taper le texte, pas après) | + | * pour aller à la ligne (80 colonnes) : set textwidth=80 (NB: à faire avant de taper le texte, pas après) |
- | * pour avoir la position du curseur (ligne, colonne) en bas à droite: set ruler (set noruler pour l'enlever) | + | * pour avoir la position du curseur (ligne, colonne) en bas à droite : set ruler (set noruler pour l'enlever) |
- | === Liens == | + | ====== Liens ====== |
- | * ((http://vimdoc.sourceforge.net/htmldoc/help.html Vim documentation: help)) online | + | * [[http://vimdoc.sourceforge.net/htmldoc/help.html| Vim documentation: help]] online |
- | * ((http://www.thomer.com/[[vi]]/vi.html Vi Lovers Home Page)) | + | * [[http://www.thomer.com/vi/vi.html| Vi Lovers Home Page]] |
- | * ((http://www.d.umn.edu/~gshute/[[vi]]/vi.html a [[vi]] Reference)) | + | * [[http://www.d.umn.edu/~gshute/vi/vi.html| a vi Reference]] |
- | * ((http://www.math.fu-berlin.de/~guckes/[[vi]]/subst.php3 Substitution Guide)) HOWTO use the ":s" command | + | * [[http://www.math.fu-berlin.de/~guckes/vi/subst.php3| Substitution Guide]] HOWTO use the ":s" command |
- | * ((http://www.linux.com/article.pl?sid=04/08/18/1558200 Getting more out of Vim)) | + | * [[http://www.linux.com/article.pl?sid=04/08/18/1558200| Getting more out of Vim]] |
- | * ((http://www.tuxfiles.org/linuxhelp/vimcheat.html The Vim commands cheat sheet)) | + | * [[http://www.tuxfiles.org/linuxhelp/vimcheat.html| The Vim commands cheat sheet]] |
- | * ((http://macvim.org/OSX/ Vim for Mac OS X)) | + | * [[http://macvim.org/OSX/| Vim for Mac OS X]] |
- | * ((http://vim.wikia.com/wiki/ Vim Tips Wiki)) | + | * [[http://vim.wikia.com/wiki/| Vim Tips Wiki]] |