2 Aug 2016

Mes trucs VIM | My VIM tricks

Pourquoi installer cygwin ou installer une VM linux sous Windows quand on peut utiliser gvim et quelques trucs...?
Why install cygwin or a Linux VM on Windows when gvim has these little tricks up its sleaves? 

Trucs VIM rapides -  Quick VIM Tricks

I've been using vi for years so the below are tricks I learned later. For a good intro, try this.

Get gvim:
Go to ftp://ftp.vim.org/pub/vim/pc/

 To highlight search keyword:
:set hlsearch
 To get uniquely sorted list of lines (as per sort -u):
:sort u
Search w/o case sensitivy:
:set ignorecase
Setting general purpose syntax coloring, good for HTTP files (not slow with big files):
:set syntax=protocols
Replace all lines (as per sed 's/origtext/newtext/g' filename):
:%s/origtext/newtext/g
-or-
 1,$ s/origtext/newtext/g
Text selection (got this tip from here):
V - selects entire lines v - selects range of text ctrl-v - selects columns gv - reselect block

After selecting the text, try d to delete, or y to copy, or :s/match/replace/, or :center, or !sort, or...
Get more help: