Sunday, October 16, 2016

How to omit the "E385: search hit BOTTOM without match for" error message produced by vim script file?

SELECT COL1 FROM ADMIN.TAB WHERE COL1 IN
(SELECT COL1 FROM AMDIN.TAB WHERE COL2 IN
(SELECT COL2 FROM AMDIN.TAB)
)
AND COL3 IN
(SELECT COL3 FROM AMDIN.TAB)
Hi,
I am a beginner on vim script...

I have written some simple vim script to indent whole "(SELECT" to ")" block o text.

The attached data.sql file is the file with data I would like to indent.
The attached indent.vim file is vim script to indent data.

I did:
1. :e data.sql
2. :source indent.vim

Scripts does exactly! what I want, the only problem is at the end it reports error:

E385: search hit BOTTOM without match for: (SELECT

This error is logical, Vim hit the bottom and it is not allowed to go to the beginning of the buffer because "set nowrapscan" does not permits this - I would like to have this setting on.

Script works fine, I would just like to omit the error message at the end.



I TRIED THIS, BUT IT DOES NOT WORK

I tried to change the line:
normal! nv%>

with this one:
silent! normal! nv%>

Error message is not displayed anymore, but last line got multiple indents, which is incorrect. So "silent!" does not fixes the problem.

How to properly omit the error message?

P.S. Maybe there is just some if statement required for error message checking and if error then exit the while loop, or something.

Regards

--
--
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:

Post a Comment