Open 0xnandhi opened 7 years ago
You're saying this happens only when you have codefmt enabled? Hard for me to see how that would be related. If so, is there a more complete error you could paste?
I met with the same problem and have found no method to solve this issue.
So this triggers in particular when you run :FormatCode
? Are there any other error details you can provide? Does it trigger the same sort of error if you run
:call maktaba#syscall#Create(['cat']).WithStdin('').Call()
or
:call maktaba#buffer#Overwrite(1, line('$'), [])
?
@dbarnett I encounter the same issue using GVim on Windows 10. Of your code snippets, the second one does work perfectly fine. I think the tmp file is either not being created correctly, or vim does not have permission to create the tmp file.
So you see the same sort of error with the first one?
How about
:echo has('job')
and
:call system(printf('cat > %s 2> %s', tempname(), tempname()), [])
?
@dbarnett
First one responds with 1
Second one flashes a window really quick and doesn't appear to do anything else.
If you need access to my machine, drop me a message and I'll get a TeamViewer session going. But for me it's super reproducible.
Okay, so to summarize observations so far and give you some context, the gist of this bug seems to be that:
Sounds like you see an error with
:call maktaba#syscall#Create(['cat']).WithStdin('').Call()
but not with
:call system(printf('cat > %s 2> %s', tempname(), tempname()), [])
(can you confirm the first one does give you a E484 error?)
I believe from the details you've given that you can temporarily work around it by disabling syscall job support when you're using Windows 10 by adding this to your .vimrc:
call maktaba#syscall#SetVimjobDisabledForTesting(1)
And then the remaining bit is to figure out whether it's a vim issue for Windows 10 or a maktaba issue.
Result of first call
:call maktaba#syscall#Create(['cat']).WithStdin('').Call()
Error detected while processing function maktaba#syscall#Call[3]..<SNR>112_DoSyscallCommon[16]..maktaba#function#Apply[1]..maktaba#function#Call[0]..maktaba#function#Call[13]..maktaba#syscall#DoCall:
line 5
E484: Can't open file C:\Users\<me>\AppData\Local\Temp\VIoFBAB.tmp
Second one does the flash, and no response
Third code snippet, I put in and get the same result after running :FormatCode
Error formatting file: Vim(let):E484: Can't open file C:\Users\<me>\AppData\Local\Temp\VIoCD01.tmp
I think the problem is in maktaba's usable_shell. I also met this problem, my solution is:
set shell=cmd
set shellcmdflag =/c
if !exists('s:usable_shell')
let s:usable_shell = '\v^/bin/sh$'
endif
to
if !exists('s:usable_shell')
"let s:usable_shell = '\v^/bin/sh$'
let s:usable_shell = '\v^cmd$'
endif
Alghouth the solution is ugly, but worked for me..(Win7, Vim8)
Ah, it makes sense that /bin/sh would be problematic on Windows. I filed google/vim-maktaba#215 with my understanding of the issue and a suggested workaround based on @kkkk9's solution (can you comment there if the other 'shell'
and 'shellcmdflag'
overrides are actually necessary? IIUC those are vim's defaults).
On Windows 10, i am facing this issue. Unable to open the temp dir for writing.
My _vimrc file:
`let $TMPDIR = "C:/Users/Balasubramanian/.vim/temp"
" initial vundle configuration. set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() "plugin installation "vundle plugin
Plugin 'VundleVim/Vundle.vim' Plugin 'scrooloose/nerdtree' Plugin 'tpope/vim-surround' Plugin 'kien/ctrlp.vim' Plugin 'scrooloose/nerdcommenter' Plugin 'DoxygenToolkit.vim' "Plugin 'rip-rip/clang_complete' Plugin 'valloric/youcompleteme' Plugin 'brookhong/cscope.vim' Plugin 'airblade/vim-rooter' Plugin 'klen/python-mode' Plugin 'nlknguyen/papercolor-theme' Plugin 'google/vim-maktaba' Plugin 'google/vim-codefmt' Plugin 'google/vim-glaive' Plugin 'flazz/vim-colorschemes' Plugin 'altercation/vim-colors-solarized' Plugin 'bling/vim-airline' Plugin 'w0rp/ale' Plugin 'cython/cython'
call vundle#end() filetype plugin indent on " the glaive#Install() should go after the "call vundle#end()" call glaive#Install() " Optional: Enable codefmt's default mappings on the= prefix.
Glaive codefmt plugin[mappings]
Glaive codefmt google_java_executable="java -jar C:/Users/Balasubramanian/.vim/bundle/vim-glaive/google-java-format-VERSION-all-deps.jar"
`
Can the community please help me ? every time i have to format the code, i am using a Visual Code to format it and i have to switch back to Vim for coding.
I have also disabled my "RealTime Scanner" , even then, get the same issue.
Thanks