Anciennes révisionsLiens de retourExporter en PDFHaut de page Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsApp Yammer RedditDerniers changementsSend via e-MailImprimerPermalien × Vi (vim) Vim, c'est THE éditeur qui correspond, dans le monde des transports, au tracteur soviétique des années '60 (la land-rover étant start); pas toujours très convivial, mais permet de tout faire… http://www.vim.org/ Astuces prochain mot: w mot précédent: b find/replace #! /bin/csh -f ed junk.txt « 'EOF' 1,$s/705/379/g w 'EOF' " pour trouver les fins de parenthèse: se placer sur la première { avec /{ puis % remplacements (mettre en commentaire de la ligne courante à la ligne courante +15) :.,+15 s/oldMotif/newMotif/g "mappings thanks to Laurent Gottardo (05.2005) :s/./\u&/g :s/./\l&/g "upper- et lowercase de la ligne courante :1,$>* /Move entire file eight spaces to the right "ou alors » en command mode fait un indent "commenter/décommenter des lignes : mainteant il décommente tout ce qui commence par un # ou :map K :s/^/#/g :map U :s/^[#\/\/]*\(.*\)/\1/g "mettre en commentaire des lignes sélectionnées dans vi :map K :s/^/#/g^M "(où le ^M est un ctrl+v ctrl+m, à savoir un afin d'executer la commande) :map U :s/^\(.*\)/\1/g^M "pour décommenter :map <F3> ! iconv -f utf8 -t latin1 \| txt2html -extract \| sed -e ':a' -e 's/<[^>]*>//g;/</N;//ba'<CR>:<CR> "pour transformer du text sélectionné en visual mode (ctrl+v) en code html [ajout Roman Graf 28.05.08] :map <F4> ! html2text<CR>:<CR> "pour transformer du code html sélectionné en visual mode (ctrl+v) en text afin de pouvoir le modifier plus facilement. "Une fois modifié en le retransforme à l'aide de <F3> en code html. (voir ci-haut) [ajout Roman Graf 28.05.08] \\ le tout, of course, à mettre dans le fichier .rc, comme ça, au startup, les keys sont déjà mappés http://www.nacs.uci.edu/indiv/gdh/vi/index.html#geek_chic (dead link) Delete all lines containing a pattern http://vim.wikia.com/wiki/Delete_all_lines_containing_a_pattern For example, to delete all lines containing "profile" (remove the /d to show the lines that the command will delete): :g/profile/d More complex patterns can be used, such as deleting all lines that are empty or that contain only whitespace: :g/^\s*$/d To delete all lines that do not contain a pattern, use g!, like this command to delete all lines that are not comment lines in a Vim script: :g!/^\s*"/d Vim documentation http://freeengineer.org/learnUNIXin10minutes.html#Vi http://vimdoc.sourceforge.net/htmldoc/usr_toc.html http://blog.interlinked.org/tutorials/vim_tutorial.html http://linux.dbw.org/vi_short_ref.html VIM AVEC STATA (en mode konsole) info/vi_vim.txt Dernière modification : 2021/11/11 08:11de radeff S'identifier