0

I am searching a pattern with /pattern starting from a random line number ln1. Sometimes I kept on going with n without realizing that I completed searching the whole file.

Given the premise, I would like vim to print a message similar to something like search 1 loop completed, once I reach ln1.

How can I edit my .vimrc to add this feature?

2
  • 1
    Isn't 'search hit BOTTOM, continuing at TOP' enough for you ? Otherwise, you'll need to reprogram n to register the first use and detect when you cycle. Is it worth it? Commented Jan 30, 2017 at 14:52
  • @LucHermitte I think the second option is worth the keystrokes.
    – Sathyam
    Commented Jan 30, 2017 at 14:54

1 Answer 1

2

Check if you have s in :set shortmess?. By default it shouldn't be there I think. If you happen to have it there, then add to .vimrc:

set shortmess-=s

Also see :h 'shortmess'

3
  • My shortmess=filnxtToO. I am a bit lost, does the exclusion of s in shortmess will let me print a message one I reached where I start?
    – Sathyam
    Commented Jan 30, 2017 at 15:10
  • This won't notify you when you reach the start, but the end of file - a cheap replacement that is already built into Vim. If you don't see that message and don't have s in shortmess, then you probably have a plugin or something mapped to n that overwrites default behaviour. Check what will be printed when you issue command map n? I have vim-interestingwords plugin that sets it's mapping on n, so I don't have s in shortmess variable and still no message displayed at the bottom of the file.
    – grodzik
    Commented Jan 31, 2017 at 7:50
  • After map n, I get No mapping found. In my vim, there is a message printed similar to search hit bottom before search starts from the top, but I was specifically looking for a way to notify me when search reach its starting point.
    – Sathyam
    Commented Jan 31, 2017 at 9:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.