1

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

D. Ben Knoble
  • 26,070
  • 3
  • 29
  • 65
Tom
  • 67
  • 7
  • Please mention what Vim version, what terminal you are using and what is $TERM set to? – Christian Brabandt Jul 13 '21 at 06:24
  • 2
    Please try with a more uptodate vim first – Christian Brabandt Jul 13 '21 at 07: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. – Martin Tournoij Jul 13 '21 at 07:52
  • Do you have any mappings on escape? – D. Ben Knoble Jul 13 '21 at 11:13
  • 2
    possibly relevant (and for your other question, too): How to debug my vimrc – D. Ben Knoble Jul 13 '21 at 17:52
  • As stated, I've removed edit markers. Editing your version info was very helpful. The reply to let us know you're off looking for a culprit could have been a comment, however, and I removed it. – D. Ben Knoble Jul 14 '21 at 17:01
  • I attempted to update Vim just recently to 8.2 but had massive problem with conflicts with python install. For whatever reason, my Vim has support for a more recent version of python than the latest Windows installer. Anyway, I gave up. – Tom Jul 16 '21 at 00:39
  • Like I said, this problem happens only very occasionally. Trying to debug my vimrc etc is impracticable. I need a way of debugging when the problem happens and with the current config. I'm guessing the best way would be to run Vim with logging all the time and wait for the problem to happen and then go look at the logfile. Any suggestion what log level would be suitable? – Tom Jul 16 '21 at 00:47

0 Answers0