How to quiet the message when filtering...

30 views
Skip to first unread message

J S

unread,
Aug 16, 2020, 1:03:01 PM8/16/20
to Vim Mailing List
I have a line in a shell script like:

vim -c '%!someFilter' someFile

The idea is to run the contents of someFile through someFilter before doing further editing.

It works fine, except for one thing. After the filter runs, but before displaying the file onscreen, it displays a message at the bottom of the screen saying something like "60 lines filtered. Press any key to continue", after which it then clears the screen and displays the file for normal editing.

There is no need for that message and pause. I would like it to go directly into the vi editing mode. Is there any way to do that?

Bantu Tu

unread,
Aug 17, 2020, 1:13:09 PM8/17/20
to vim_use
vim -c 'sil%!someFilter' someFile

:h :sil

J S

unread,
Aug 17, 2020, 8:51:36 PM8/17/20
to Vim Mailing List
Yes! "sil" works well - in the simple case. Thanks for that.

Now, on to the next. Suppose we have another command like:

vim -c '...' -c '...' -c '...' and so on and so forth - a long series of commands that modify the text, then finally dump me into the editor. I want all of them silenced - and it to go directly into the editor with no pausing. Assume it is either impractical or impossible to put "sil" in front of every command.

Is there a some setting or other to turn on silent mode globally?

--
--
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+unsub...@googlegroups.com.

Anton Wessel

unread,
Aug 18, 2020, 3:06:44 AM8/18/20
to vim...@googlegroups.com
please do.not send me any emails more.
your given link is not an existing email address.
Anton_...@t-online.de




Gesendet mit der Telekom Mail App



--- Original-Nachricht ---
Von: Bantu Tu
Betreff: How to quiet the message when filtering...
Datum: 17. August 2020, 16:28
An: vim_use




vim -c 'sil%!someFilter' someFile

:h :sil

--
--
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+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/945ce29d-b11f-4c48-9b5f-c5271b355af4o%40googlegroups.com.

Christian Brabandt

unread,
Aug 18, 2020, 4:19:36 AM8/18/20
to Vim Mailing List

On Di, 18 Aug 2020, 'J S' via vim_use wrote:

> Yes! "sil" works well - in the simple case. Thanks for that.
>
> Now, on to the next. Suppose we have another command like:
>
> vim -c '...' -c '...' -c '...' and so on and so forth - a long series of commands that modify the text, then finally dump me into the editor. I want all of them silenced - and it to go directly into the editor with no pausing. Assume it is either impractical or impossible to put "sil" in front of every command.
>
> Is there a some setting or other to turn on silent mode globally?

You can try to use the -s and -e option (see :h -s-ex)

This may or may not help, I don't know for sure.

Best,
Christian
--
F: Warum haben Giraffen so einen langen Hals?
A: Weil der Kopf so weit oben ist.

Christian Brabandt

unread,
Aug 18, 2020, 4:25:43 AM8/18/20
to Anton Wessel, vim...@googlegroups.com

Anton Wessel schrieb am Dienstag, den 18. August 2020:

> please do not send me any emails more.

If you read each message carefully, you'll notice this at the bottom:

> 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+u...@googlegroups.com.
> <mailto:vim_use+u...@googlegroups.com.>
So please send a mail to the given email address. For now I have set
your membership to not receive any message, but I cannot unsubscribe
you.

Best,
Christian
--
Ich bin nicht immer Deiner Meinung.
-- Paul Ambroise Valéry

J S

unread,
Aug 18, 2020, 8:02:12 AM8/18/20
to Vim Mailing List
Actually, I figured out from the help file a workaround, which is to put all the commands into a function and then do: silent call Function()

It is funny how often functions are the workaround for a lot of the quirks in the Vim ecosystem.

Anyway, I think I will go with that - at least for now - but I will look into the '-s-ex' option at some later time (I did read about it; just haven't tested it yet). Thanks.

P.S. It still seems to me like there should be an option, like "set silent/set nosilent' to just turn it on/off globally. That sounds like something that should be included in a future version.

--
--
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+unsub...@googlegroups.com.

Christian Brabandt

unread,
Aug 18, 2020, 10:14:49 AM8/18/20
to Vim Mailing List

On Di, 18 Aug 2020, 'J S' via vim_use wrote:

> Actually, I figured out from the help file a workaround, which is to put all the commands into a function and then do: silent call Function()
>
> It is funny how often functions are the workaround for a lot of the quirks in the Vim ecosystem.
>
> Anyway, I think I will go with that - at least for now - but I will look into the '-s-ex' option at some later time (I did read about it; just haven't tested it yet). Thanks.
>
> P.S. It still seems to me like there should be an option, like "set silent/set nosilent' to just turn it on/off globally. That sounds like something that should be included in a future version.

If possible we want to avoid adding yet another Option.

Best,
Christian
--
Ist die Bundesregierung "das Böse"? Natürlich nicht! Das Böse müssen
wir uns als etwas Großes vorstellen - da kann es die Bundesregierung schon
mal nicht sein. Da würden wir dem Bösen nicht gerecht.
-- Georg Schramm

J S

unread,
Aug 19, 2020, 3:11:37 PM8/19/20
to Vim Mailing List

So, having worked with it a bit, I'm now content with using "silent" to solve this issue. Although a little convoluted, it seems pretty straightforward to put all the commands into a function, and then create a command to call that function with silent. I.e..:

command! MyCommand silent call MyFunction()

Then everything works as expected with MyCommand.

But I am curious as to why you say that the Vim Developers are trying to avoid adding options. Is there any intrinsic reason why adding options is undesirable?

Is it just "feature creep" - i.e., if you do it for me, then you have to do it for the next guy and the next guy and so on?

--
--
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+unsub...@googlegroups.com.

Andy Wokula

unread,
Aug 20, 2020, 7:53:14 AM8/20/20
to vim...@googlegroups.com
Am 19.08.2020 um 21:11 schrieb 'J S' via vim_use:
> But I am curious as to why you say that the Vim Developers are trying
> to avoid adding options. Is there any intrinsic reason why adding
> options is undesirable?

I think it's more about the option in question:
(1) a global silent mode can too easily make your editor unusable
(2) you can already use :sil + function call

So there is not even a use case (besides stupid pranks maybe).

--
Andy
Reply all
Reply to author
Forward
0 new messages