0

I edit a lot of files using netrw in gvim. Sometimes, when I mash C-s to save, it will hang my vim session. I'm not sure if this is because of a network error, or because I also sometimes hit C-z at about the same time and do something bad to the child process, like sending it a pause signal. After I do it, I can't seem to regain control of my session: mashing various combinations of Esc, C-c, C-q, Pause/Break, and so on don't seem to do anything.

Vim being stuck. Among my random mashings trying to get control back, it says Error detected while processing function netrw#NetWrite[336]..<SNR>36_NetrwExe:, line 11:, and E676: No matching autocommands for acwrite buffer

I can hit "X" on the gvim window and get a prompt to save my unsaved work, so vim is still working, but I can't change tabs or use any of the gvim GUI or issue any normal mode commands. pstree looks like this:

        |         |-gvim-+-bash---sftp---ssh
        |         |      `-3*[{gvim}]

Is there something I can do in Vim to abort whatever netrw script is running and get my command prompt back? Is it really hitting C-z at the wrong time that causes this, or is it something else? Is there something I can do at the system level, like killall -9 sftp, that will make vim start listening to me again?

Is there something I can do to prevent this from happening in the future?

4
  • 1
    Depending on your terminal, <c-s> might be a shortcut to pause it's flow until you hit <c-q>. You'll need to tweak your terminal settings to avoid that, if that's the cause of your problem.
    – Biggybi
    Oct 21 at 7:37
  • I don't think that's it; I'm using gvim, which does all its own terminal emulation, and the mswin bindings that have C-s mapped to save. Usually, C-s will save without stopping flow in gvim's internal terminal, and when the session does get stuck, C-q does not unstick it.
    – interfect
    Oct 21 at 15:27
  • Oh indeed. Do you use your own config? If so you can try to debug it.
    – Biggybi
    Oct 21 at 16:41
  • I can see if I can reproduce this with a non-customized config. I've found I can reliably trigger the problem by hitting C-z immediately after C-s to save, assuming the file has actually been modified. Then, I actually can get it out of the stuck state with killall -9 sftp. So I think my C-z is making it through to the other processes that gvim starts, and pausing the copy job. But I don't actually have access to that bash to put the job back into the foreground and I get stuck.
    – interfect
    Oct 21 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.