Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim temporary files with native vim on windows

When running a native compilation of gVim under Win7 I have the following in my vimrc:

if has ("win32")
  let $TMP="C:/tmp"
  setlocal equalprg=tidy\ --output-xhtml\ y\ -utf8\ --wrap-attributes\ 1\ --vertical-space\ 1\ --indent\ auto\ --wrap\ 0\ --show-body-only\ auto\ --preserve-entities\ 1\ -q\ -f\ shellpipe=2>
endif

This should create a temp file. However, after running the command, I see:

shell returned 1

E485: Can't read file C:\tmp\VIoC935.tmp

The common recommendation for native windows E485 errors is to set the tmp variable, which I have, as you can see from my vimrc snippet. If I remove the let statement, I get a similar result:

shell returned 1

E485: Can't read file C:\Users\ksk\AppData\Local\Temp\VIfFA01.tmp

In both cases; both directories exist and gVim can write a file to those locations, i.e.,

:w C:\Users\ksk\AppData\Local\Temp\VIfFA01.tmp

in the current buffer will write this file without error.

Interestingly, while writing this, I found that if I create a new buffer, and delete the original buffer, the equalprg function runs without error (with and without the "let" statement in vimrc)

like image 920
Screenack Avatar asked Jan 17 '23 00:01

Screenack


1 Answers

This doesn't apply to the original question, but I ran into the same symptoms because of the setting of my SHELL variable within gvim. I was launching gvim from a Cygwin window, and it picked up the SHELL setting from within cygwin: /bin/bash. I had to do a ":set SHELL=C:/cygwin/bin/bash" from within gvim, and then the temporary file problem went away. So check the setting of your SHELL variable within gVim (via ":set shell") when trying to troubleshoot this kind of problem.

like image 190
dewtell Avatar answered Jan 22 '23 21:01

dewtell