On 2023-06-15, Bram Moolenaar wrote:
> > Help for :map-<silent> says that with <silent>, the right side of
> > a mapping will not be echoed on the command line, but messages from
> > the executed command are still given. This works with :nmap but not
> > with :vmap. I would expect it to work with :vmap as well.
> >
> > Steps to reproduce
> >
> > 1. Put the following in a file, say foo.vim.
> >
> > nmap <silent> gx :call DebugSilent()<CR>
> > vmap <silent> gx :call DebugSilent()<CR>
> > function DebugSilent()
> > echomsg "from DebugSilent"
> > endfunction
> >
> > 2. Start vim and source that file.
> >
> > $ vim -N --clean
> > :so foo.vim
> >
> > 3. Enter some word into the current buffer.
> >
> > 4. Visually select that word.
> >
> > viw
> >
> > 5. Type the mapping.
> >
> > gx
> >
> > 6. Note that no message appears, or just flashes by briefly.
> >
> > 7. Execute :messages to verify that the message was generated and
> > saved in message history.
> >
> > 8. Without visually selecting the word, type the mapping.
> >
> > gx
> >
> > 9. Note that the message does appear in the command line and
> > remains there.
> >
> > Expected behavior
> >
> > I expect the message to remain in the command line after the
> > execution of the vmap just as it does for a normal map.
>
> It appears to work as you expect when 'cmdheight' is 2 or more.
>
> Most likely the message is cleared when the "-- VISUAL --" mode message
> is removed. Setting 'noshowmode' helps.
>
> This should not happen though, when the message overwrites the mode then
> there is no need later to clear the mode message.
I would expect it to work like gf (which itself is inconsistent).
If I put the cursor over "later" in the paragraph above and type
gf, I get a persistent error message in the command line:
E447: Can't find file "later" in path
If I visually-select "later" with viw and type gf, I get the same
message, but it appears for only about one second. It seems like it
should also persist, but at least I see it and can look in :messages
to read it again.
'cmdheight' doesn't seem to affect the behavior of gf, but setting
'noshowmode' does "fix" it. It would be nice if visual mode could
be made smarter about clearing "-- VISUAL --" when that message has
been overwritten, or at least leave it for a second or two as
{Visual}gf does.
Regards,
Gary
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230615162716.GC6600%40phoenix.