Vim

Find and replace

To replace all foo with bar within the current buffer

:%s/foo/bar/g

To search in the working directory:

:Ack foo

Or, search in the specified path:

:Ack foo /path/to/dir

Now, the quickfix window shows up with every result found. Delete the undesired result by typing dd.

To replace every result still present in the quickfix window:

:Acks /foo/bar/