2

I've recently switched to Neovim, and some days in, I realized that there was no search hit BOTTOM, continuing at TOP message when jumping from the last to the first search result (or vice versa), which I'm relying on fairly regularly. I did some experimenting and figured out that the current pattern shown in the status bar (e.g., /\<foo\>) overwrites the error message.

The message can be restored by silencing the search navigation commands with the following (otherwise empty) config and --noplugin:

" ~/.config/nvim/init.vim

nnoremap <silent> * *
nnoremap <silent> n n
" ... (omitting backward, g*, etc.)

set shortmess=
" set shortmess+=s  " don't give "search hit BOTTOM, continuing at TOP" ...

The problem with this approach is twofold:

  • The search hit BOTTOM... does not disappear when jumping from the first to the second result after wrap-jumping from the last to the first;

  • The current search pattern (and [i/n] counter) is no longer shown.

While I still prefer this state to the former, the ideal situation would be as follows:

  • The current search result with counter is shown by default after starting a search or jumping between results.

  • However, when jumping from the first to the last search result in the file (or vice versa), the message search hit BOTTOM, continuing at TOP (or vice versa) is shown instead -- but disappears on further movement, e.g., when jumping on to the second result.

How can this be achieved?


PS: I'm running NVIM V0.4.3 (LuaJIT 2.0.5, Features: +acl +iconv +tui) on Manjaro Linux.

4
  • It looks like it's an issue with that mapping; it works like that for me in both Vim and neovim. Looks like "make * and # highlight the match without jumping or any side-effects" is a bit tricky. Apr 24, 2020 at 6:30
  • @MartinTournoij No, the original problem of the missing search hit BOTTOM... occurs even with a completely empty init.vim, and the mapping in the "PS" is not part of the test config in the main part of the question (as I attempted to clarify with "not referring to the test file shown above, of course").
    – flotzilla
    Apr 24, 2020 at 7:48
  • It's that not part of the problem, then it's probably best to leave it out of the question? It works well with the default settings for me btw (when nowrapscan is set), if it doesn't for you then that sounds like a possible bug in neovim? Apr 24, 2020 at 8:50
  • Yes you're probably right, I'll remove it.
    – flotzilla
    Apr 24, 2020 at 8:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.