VIM

Jeg faldt over noget VIM stuff, som burde gøre det lettere at lege php i VIM. Der er attached en PDF med beskrivelse af indholdet af den pakke der også er attached.

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

Find each occurrence of 'foo', and replace it with 'bar'.

:%s/foo/bar/gc

Change each 'foo' to 'bar', but ask for confirmation first.

:%s/\<foo\>/bar/gc

Change only whole words exactly matching 'foo' to 'bar'; ask for confirmation.

:%s/foo/bar/gci

Change each 'foo' (case insensitive) to 'bar'; ask for confirmation.

:%s/foo/bar/gcI

Change each 'foo' (case sensitive) to 'bar'; ask for confirmation.

The g flag means global – each occurrence in the line is changed, rather than just the first.