Tuesday, March 12, 2013

How do I block the message "Pattern not found" in :s

I've written a couple of functions which change the formatting of C++ code, to bring it in line with our coding guidelines; things along the lines of:

function! FixParen()
s/( */( /g
s/ *)/ )/g
s/( *)/()/g
endfunction

The problem is that when calling these over a range (the usual procedure), vim invokes the function once per line; a lot of lines don't have anything which needs fixing, and cause the message "Pattern not found" to be emitted. Is there any way of inhibiting this?

--
James

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: