Play sound on search wrap

11 views
Skip to first unread message

Lifepillar

unread,
Oct 6, 2022, 3:33:20 PM10/6/22
to vim...@googlegroups.com
When performing a search, it's easy for me to miss the "search hit
BOTTOM, continuing at TOP" message because my attention is focused on
the matches. For this reason, I'd like a sound of my choice to be played
when the search wraps (using +sound). Is this possible?

Thanks,
Life.

Bram Moolenaar

unread,
Oct 6, 2022, 4:25:17 PM10/6/22
to vim...@googlegroups.com, Lifepillar
No, don't see a way.

--
DINGO: You must spank her well and after you have spanked her you
may deal with her as you like and then ... spank me.
AMAZING: And spank me!
STUNNER: And me.
LOVELY: And me.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

Arun

unread,
Oct 6, 2022, 6:13:26 PM10/6/22
to vim...@googlegroups.com
You could try a hack by calling a function that checks for v:warningmsg and reset it, in a "statusline" invoked function. Something like:

---
fu! CheckWrap()
    if v:warningmsg =~# "^search hit [BT]"
        "Ring bell
        exe "norm! \<Esc>"
    endif
    let v:warningmsg=""
endf
"call CheckWrap using standard statusline
set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P%{CheckWrap()}
---

The above should ring the bell (provided you did not disable it) on search wraps.

Regards,
-Arun

--
--
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/thnahj%24rq5%241%40ciao.gmane.io.

Lifepillar

unread,
Oct 7, 2022, 4:31:27 PM10/7/22
to vim...@googlegroups.com
On 2022-10-06, Arun <finda...@gmail.com> wrote:
> You could try a hack by calling a function that checks for v:warningmsg and
> reset it, in a "statusline" invoked function. Something like:
>
> ---
> fu! CheckWrap()
> if v:warningmsg =~# "^search hit [BT]"
> "Ring bell
> exe "norm! \<Esc>"
> endif
> let v:warningmsg=""
> endf
> "call CheckWrap using standard statusline
> set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P%{CheckWrap()}
> ---
>
> The above should ring the bell (provided you did not disable it) on search
> wraps.

Aha, hackish, but that does work!

Thanks,
Life.

Reply all
Reply to author
Forward
0 new messages