I would like for my vim (actually, neovim) to jump always to a label I leave in the text (or the first one, if there is more than one). So, I have setup this autocommand:
au BufNewFile,BufRead * call search('\$\$\$')
and hope that it would work. Unfortunately, BufRead
seems like not enough, because when I open the file now, it just opens it at the top again.
So, I replaced BufRead
with BufEnter
(after trying BufReadPost
, which didn’t work either), and now vim truly jumps to the label, unfortunately it is a way to eager to do it. It jumps to the label (and possibly even replaces the text) when I use spellchecker or basically any time I return to that buffer from anywhere. That is too much.
However, the main point is that I don’t understand, why that BufRead
doesn’t work in the first place.