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.
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?
![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](../../images/f5d6955b4bc00bd688b3c8bea384969f.webp)
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
– interfect Oct 21 '21 at 18:33killall -9 sftp. So I think my C-z is making it through to the other processes thatgvimstarts, 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.