Ignore Errors in VIM operations

Sometimes it is required to ignore errors in vim command.
For an example, consider a case where you have macro which includes seach
operaton. While running this macro if seach fails, macro will terminate.

There are ways to ignore errors in vim:

  • Ignore Errors in replace:

use ‘e’ option in replace command:
e.g.

:%s/old/new/e
  • Ignore Errors in search:

use :silent! command with serach to ignore search error.
e.g.

:silent! /text_to_search

Leave a comment