VIM starting in replace mode

When launching vim in bash console, it starts in replace mod by default. Is there a way to make it start in normal mode?

I didn't make any changes to the original vimrc and even without one the problem remains. I've tried this, this and this among others.

I have vague memories of this not being an issue before. Does anyone else experiences it?

I have seen that myself in the past. I think what happens is that the history buffer for our consoles gets some kind of strange escape sequence in it, and that gets played to vim when it's opened -- but I don't quite see how it could happen or have that effect. IIRC it is fixed by closing the bash console in question, then starting a new one -- could you try that and see if it helps?

I find the simplest solution is not to use vim to edit files


Restarting the console was one of the first things that I've tried. The problem persists across consoles/sessions, even after purging .bash_history and .viminfo.

But it does not persist across browsers. The behaviour shows only in Firefox (only checked 64.0), even in incognito mode. Works fine in Chrome and Edge.

Hmmm, that's weird. Maybe it's something in the browser cache? Even in incognito mode, some elements of the cache from non-incognito mode are shared (nothing is shared in the other direction, of course). So if you delete all pythonanywhere-related content from your Firefox cache, perhaps it will sort it out?

I went the extra mile and deleted all cache and cookies. Additionally I've disabled blocking of tracking cookies. It didn't change the behaviour.

This leads me to believe it's an issue with Firefox . Maybe a new version will change something.

That's really weird! Which version of Firefox are you using? I'm on my home machine at the moment, and don't have FF installed, but I do at work, so I can do a comparison of different versions when I'm in the office tomorrow.

I'm running Firefox Quantum 64.0. Just to be on the safe side I've disabled all extensions, but that changed nothing.

Very odd. I've just checked myself with Firefox 64, and I don't get that problem. Maybe as an experiment you could sign up for another account (just a free one, of course) and see whether you get the same behaviour in your FF?

Ok, so I'm back with some resoults. Created a new account and logged in using the same computer and the same browser. And to my surprise - the behaviour was not replicated. Vim started in normal mode, just as one would expect.

This is very puzzling. I'll try to compare user config files from both accounts and see if there are any differences...

This is something that I've encountered a few times and every time I try to track it down, it magically goes away before I can find out what's causing it. It's really frustrating.

Just a little bit more info: vim.tiny is not affected nor is vimtutor.

From vimtutor one can check that it launches vim as:

vim -f -u NONE -c "set nocp"

When executing vim -u NONE vim starts in normal mode, as expected

So i tried with different configs:

/etc/vim/vimrc starts in replace

/etc/vim/vimrc.tiny starts in normal

Hmm, interesting. So it sounds like it's somehow connected to the system default vim config. I've just checked, and you're on our (somewhat old) "dangermouse" system image. And now I think about it, it feels like I haven't seen this problem in quite a while -- perhaps since I switched over to our newer "earlgrey" image (which has its vim config in a different place, which is how I noticed that my system image was different to yours).

I wonder if the problem would be fixed if we switched you over to earlgrey too? It wouldn't be an entirely cost-free experiment, because earlgrey has newer versions of Python and of many of of the pre-installed Python modules, which means that any code that you have that relies on the pre-installed packages might break if it's not compatible with the new versions, and that any virtualenvs might need rebuilding (because -- for example -- envs for 2.7.6 aren't always compatible with 2.6.12, and so on).

But if you think it's worth it, we can certainly switch you over. It would have the added benefit of adding support for Python 3.7 to your account.

I think the risk is worth taking. If anything cod-related breaks I can just patch it.

If you could, please move to to earlgrey at your leisure.

OK -- that's done now. Any new consoles you start will have the new system image; websites and scheduled/always-on tasks will pick it up the next time they're started. If you need it switched back, just let us know.

Thank you so much! Vim is finally acting as expected :)

That's awesome! Thanks for confirming :-) Must have been something weird about our old vim configuration file, though I still can't understand why it didn't happen in some browsers.