If you want to have custom startup setting for Vim in a Cygwin session, do the following:
Sometimes, VIM does not correctly apply syntax highlighting rules. In my case, I found that this happens a lot with Visual Basic files. You can override the syntax highlighting rules, forcing a set of syntax rules to be applied based on a file’s extension, as follows. For example, if you find that .cls (VB class files) are not being handled as Visual Basic files, add the following to your vimrc file:
“au BufNewFile,BufRead *.cls set filetype=vb”
For other file types, just add a line similar to the one above, changing the “*.cls” and “vb” values as needed.
If you want Vim to be automatically maximized when you run it, enter the following as the last statement in your vimrc file: “au GUIEnter * simalt ~x” (without the quotes)
(from here)
The :substitute command searches for a text pattern, and replaces it with a text string. There are many options, but these are what you probably want:
:%s/foo/bar/g
…finds each occurrence of ‘foo’ (in all lines), and replaces it with ‘bar’.
:s/foo/bar/g
…finds each occurrence of ‘foo’ (in the current line only), and replaces it with ‘bar’.
:%s/foo/bar/gc
…changes each ‘foo’ to ‘bar’, but asks for confirmation first.
:%s/\<foo\>/bar/gc
…changes only whole words exactly matching ‘foo’ to ‘bar’; asks for confirmation.
:%s/foo/bar/gci
…changes each ‘foo’ (case insensitive) to ‘bar’; asks for confirmation. This may be wanted after using :set noignorecase to make searches case sensitive (the default).
:%s/foo/bar/gcI
…changes each ‘foo’ (case sensitive) to ‘bar’; asks for confirmation. This may be wanted after using :set ignorecase to make searches case insensitive.