On Thu, Apr 9, 2015 at 10:41 AM, Ben Fritz <[email protected]> wrote:

> On Thursday, April 9, 2015 at 8:17:20 AM UTC-5, Igor Forca wrote:
> > So I need to do write something in the following logic:
> >
> > if
> >     one or many semicolon characters exists in plan text file
> > then
> >     in status bar display error message: "Corrupted file. Please check
> for semicolon character."
> >     and do not continue executing commands
> > else
> >     do all that substitute commands.
> > end
> >
> > Thanks
>
> Probably you want the search() function, which will return 0 if no matches
> are found in the buffer.


More explicitly, try something like this (untested):

:source foo.vim

where foo.vim contains the lines

if search(';', 'cnw')
  echoerr 'Corrupted file. Please check for semicolon character.'
  finish
endif
%s/\<emacs\>/vim/g

:help search()
:help :echoerr

-- 
HTH, Benji Fisher

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to