Question

I am using a lot applications from portableapps.com for work, and more particularly 7-zip portable and gVim portable.

I have set 7zip's external editor to gVimPortable.exe. It works perfectly when editing a file that is not inside an archive or compressed file… but it miserably fails when editing a file inside an archive or compressed file.

What happens is that 7-zip portable stores the file to a temporary place, launches gvimportable.exe, which forks and opens gvim.exe.

And some time after gvimportable.exe exits, I can see in Procmon that 7zFM.exe does a “SetDispositionInformationFile” (Details: “Delete: True”) that deletes the temporary file, and when gvim tries to open it, the file has been deleted.

Note that it works perfectly if I set the editor to NotepadPlusPlusportable.exe.

Do you have an explanation for this behaviour?

Please not that the -f option of gVimPortable.exe does not solve my problem.

Was it helpful?

Solution

When gvim started as you say by default it forks and exits so 7z thinks that the edit has finished and deletes the file.

What you need is to pass the argument -f or --nofork to prevent this.

See the startup section in the gvim manual

rev1

add

let &guioptions = "gmrLtTf"

to _vimrc (Edit->Startup Settings)

OTHER TIPS

I think I've found a solution, at least works on my env (7zip v9.20 + gVim 7.2 from portableapps).

  1. Set the 7zip editor to use <base>\App\vim\vim72\gVim.exe instead of the <base>\gVimPortable.exe
  2. Put your .vimrc file at <base>\App\vim\_gvimrc (not in <base>\Data\setting).

Explanation:

  1. 7zip will delete temp file after it thinks the external app terminated, I think the gVimPortable gives 7zip wrong indication on this. So use gVimPortable, you need luck to see the content, as it must fast enough to open the file before 7zip delete it, sometime works, sometimes not. But 7zip could always correctly detect the gVim.
  2. I just made a guess, but seems both <base>\App\vim\vim72\gVim.exe and <base>\gVimPortable.exe could load <base>\App\vim\_gvimrc :-)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top