I have a mysterious, troubling, and extremely irritating problem with what might be called auto-edits of my vimrc file.

It only happens when I open vimrc file from buffer list (ie there are a number of buffers listed) or with :e vimrc.

It only happens very occasionally and so is almost impossible to debug.

What happens is, when opening my vimrc file from the bufferlist, the first thing that happens is one char is deleted in normal mode wherever the cursor happens to be (I have a very standard function in vimrc to place cursor at last position).

I'm getting good at spotting it when it does happen but I've missed it in the past and it's created huge problems; it is, after all, my vimrc file and pretty massive at that (currently 3700+ lines)!

If I could somehow initiate a debugging session when I see it happening (because when it does happen, I can switch between buffers and watch it happen again and again), but if I ever try to start vim in verbose mode (eg. gvim -V9myVim.log) I've never managed to replicate the issue.

It's so frustrating and I'm beginning to believe it's not just 'accidental' (portentous squinting and furrowing of brow).

Please help!

VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 9 2018 01:29:11) MS-Windows 32-bit GUI version with OLE support Included patches: 1-354

  • Please mention what Vim version, what terminal you are using and what is $TERM set to? Jul 13, 2021 at 6:24
  • 2
    Please try with a more uptodate vim first Jul 13, 2021 at 7:46
  • 1
    Are you sure there isn't some autocmd in your huge vimrc (possibly from a plugin)? That would be my first suspect anyway. You can see all autocmds for the vim filetype with :au FileType vim; although it could also be on some other event (use :au to see all of them, but it will probably be a long list, you can add it to a buffer with :call setline('.', execute('au')->split('\n')) and then search for vim maybe). But like Christian said: I'd try with a newer Vim first; 8.1.354 is almost three years old. Jul 13, 2021 at 7:52
  • Do you have any mappings on escape?
    – D. Ben Knoble
    Jul 13, 2021 at 11:13
  • 2
    possibly relevant (and for your other question, too): How to debug my vimrc
    – D. Ben Knoble
    Jul 13, 2021 at 17:52


Your Answer

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

Browse other questions tagged or ask your own question.