Thursday, April 9, 2015

Re: How to check for semicolon character in plan text file and if exists report an error message?

On Thursday, April 9, 2015 at 8:17:20 AM UTC-5, Igor Forca wrote:
> Hi,
> using Vim 7.4 on Windows 7.
>
> I have a plain text file and I would like to execute several commands from vimscript file, there are some :s[ubstitute] commands, nothing fancy.
> But "substitute" commands should not be executed if there is at least one semicolon character ";" in plain text file.
>
> 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.

--
--
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/d/optout.

No comments: