Advice on echom informational logging

40 views
Skip to first unread message

Paul Jolly

unread,
Jun 12, 2019, 12:06:26 PM6/12/19
to vim...@googlegroups.com
Hi all,

I would like to kindly ask for some advice on how to do informational
logging in Vim.

When govim (https://github.com/myitcv/govim) starts up, it checks
whether it needs to "go install" a new version of the Go part of the
plugin, as well as gopls (the LSP server).

In order to keep the user informed (because otherwise things would
just appear to hang), I echom a message:

:echom "Installing govim and gopls"
:call feedkeys(" ") " to prevent press ENTER to continue

(source: https://github.com/myitcv/govim/blob/c14a323551a641734eaef3c70cee9bd21e862d18/plugin/govim.vim#L298-L299)

Notice the "hack" to prevent the "press ENTER to continue" prompt. I
did this because it seemed impossible/contradictory to me to use
:silent with :echom.

I follow a similar approach for sharing the location of two key
logfiles (govim is still relatively immature, so referring to these
happens more often than is desirable).

What's annoying about this approach (beyond the fact that it feels
like a hack) is that when I quit vim it leaves a couple of lines of
artefacts as output in terminal:

$ vi
Vim channel logfile: /tmp/vim_channel_log_20190612_1700_11_poZWE0oDJxp3
Press ENTER or type command to continue

Does anyone have any pointers/advice on how to do this better?

Many thanks,


Paul

Bram Moolenaar

unread,
Jun 12, 2019, 1:06:18 PM6/12/19
to vim...@googlegroups.com, Paul Jolly
This is what popup_notification() is for. It's not implemented yet
though. By default it shows a message for three seconds. Maybe I'll
implement a way to close it, so you can keep it up longer.

--
hundred-and-one symptoms of being an internet addict:
157. You fum through a magazine, you first check to see if it has a web
address.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Paul Jolly

unread,
Jun 12, 2019, 1:15:35 PM6/12/19
to Bram Moolenaar, vim...@googlegroups.com
> This is what popup_notification() is for. It's not implemented yet
> though. By default it shows a message for three seconds. Maybe I'll
> implement a way to close it, so you can keep it up longer.

Thanks, Bram.

I need these messages to appear as the plugin/govim.vim file is being
sourced (because that's when the installation is carried out, if
necessary). Based on what I've seen so far, the Vim "window" is not
visible at this point, I'm effectively still in bash prompt world.
Does that make sense?

Bram Moolenaar

unread,
Jun 12, 2019, 2:39:57 PM6/12/19
to vim...@googlegroups.com, Paul Jolly
Well, then perhaps use a shell command?

silent !echo read this message

--
Send $25.00 for handy leaflet on how to make money by selling leaflets

Paul Jolly

unread,
Jun 13, 2019, 5:17:27 AM6/13/19
to Bram Moolenaar, vim...@googlegroups.com
> Well, then perhaps use a shell command?
>
> silent !echo read this message

For some reason, using this approach I don't actually see the message
(I just get a blank terminal) until I quit Vim, i.e. I don't see it at
the critical time immediately before the install is attempted.

I think for now I'm going to only use this echom + feedkeys hack when
installing the Go programs; I'll just have a simple command that the
user can invoke to echom the log file locations. That should keep the
noise down.

Thanks for the thoughts and suggestions in any case.
Reply all
Reply to author
Forward
0 new messages