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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s