google / vim-maktaba

Consistent Vimscript
Apache License 2.0
590 stars 42 forks source link

maktaba#syscall# doesn't work properly for Windows #215

Open dbarnett opened 6 years ago

dbarnett commented 6 years ago

The syscall support in maktaba tries to force /bin/sh when it checks if the shell value is usable, and doesn't work properly on Windows. Configuring it to allow cmd might help, but there may be other assumptions on what syntax the shell supports that won't work properly with Windows' cmd program.

When users are running into this issue, the symptom is that syscalls are failing with E484: Can't open file C:\Users\<me>\AppData\Local\Temp\VIoFBAB.tmp.

dbarnett commented 6 years ago

Should be able to work around the shell override by adding

call maktaba#syscall#SetUsableShellRegex('\v^/bin/sh|cmd|cmd\.exe|command\.com$')

to your vimrc after maktaba is loaded, and then vim will at least try to use cmd.

dbarnett commented 4 years ago

In general, we should try to detect and give a better error when the shell doesn't exist. The vim error from system() for that case isn't great... I see a subtle "Cannot execute shell" followed by a bright red error like E484: Can't open file /tmp/vysbXL0/5.

dbarnett commented 4 years ago

I tried firing up Wine and installing vim but I can't even figure out how to get it to invoke any shell command. I tried

:set shell=cmd.exe
:echo system('dir')

and a bunch of variations on that with different shell settings and :! instead of system(). Also, strangely, the shell setting defaults to /bin/bash for me (I guess from the host Linux system) and :echo executable(&shell) returns true but actually trying to execute it doesn't work. Maybe Wine isn't the best environment to try to get something working here…

I don't want to break it for anyone on Windows that somehow has it working but I can't do much for people reporting weird errors. Maybe I could soft-disable it with a meaningful warning message that tells you "If you want to try to get it working, do XYZ to enable it and then follow up on https://github.com/google/vim-maktaba/issues/215 to discuss how it's working for you"…