My suggestion is to use a range combined with searching backwards via ?
.
:1?XXXX
Overview:
1?XXXX
is the range.
- The
1
means first line of the file.
?XXXX
means search backwards from the first line (wrapping around) until you find the pattern XXXX
As ZyX mentioned this relies on wrapscan
to be set, which it is by default. See :h 'wrapscan'
for more information.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…