You are here

gvim swap files

10 posts / 0 new
Last post
besonen
Offline
Last seen: 11 years 11 months ago
Joined: 2007-04-21 16:32
gvim swap files

gvim portable does not create swap files. this is important because these are used by gvim for file recovery.

i attempted to manually force the creation of swap files by adding these lines to my _vimrc file:

set updatecount=50
set updatetime=1000

no go.

any ideas on how to make gvim portable create swap files?

thanks,
david

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Disabled for portability

I disabled this for portability reasons (so that the swap files don't get left there). Besides, I've had them disabled myself for a long time because they caused trouble. Looking back on it now, I could have modified the default vimrc file to set dir=$TEMP (which lands on the disk) and not pass -n. I might think about this for the next release.

You can do it manually in the mean time by editing Other\Source\gVimPortable.nsi, line 137, and remove the "-n " argument from there, and then recompile it with NSIS Portable, then it'll work for you.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

besonen
Offline
Last seen: 11 years 11 months ago
Joined: 2007-04-21 16:32
recompiling without "-n"

Chris Morgan I disabled this for portability easons (so that the swap files don't get left there).

"there" being the portable media?

Chris Morgan I've had them disabled myself for a long time because they caused trouble.

what kind of trouble did you experience?

Chris Morgan Looking back on it now, I could have modified the default vimrc file to set dir=$TEMP (which lands on the disk)

i would think you would want to set the swap file location to the gvim portable directory. that way if the system crashed the recoverable swap file would be with the portable media.

Chris Morgan and not pass -n. I might think about this for the next release.

but as long as you were not passing "-n" then the local portable app directory can be specified in the vimrc file.

could you re-release gvim minus "-n" within the next two weeks?

Chris Morgan You can do it manually in the mean time by editing Other\Source\gVimPortable.nsi, line 137, and remove the "-n " argument from there, and then recompile it with NSIS Portable, then it'll work for you.

thanks for that tip. unfortunately i'm not familiar with compiling with NSIS Portable. so i kind of need to wait until someone else recompiles gvim.

if you think it might take me less than half an hour to recompile gvim with NSIS Portable, point me to some explicit instructions and i'll work on it.

thanks,
david

[Reformatted to make it much more readable - mod Chris]

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
I disabled it so that swap

I disabled it so that swap files won't get left anywhere - the main drive or the USB drive.

I just had trouble with them in earlier versions of Vim which were less stable, and also didn't like having the swp files there (they got in the way with the tab order in Command Prompt and things like that). They (and the backup files which I disable) got in the way with backups too. Now I wouldn't mind so much having swap files again... but I'm happy with them off myself.

$TEMP goes inside gVimPortable\Data\temp, so if I did that it would end up in the gVim Portable directory. (Sorry, I wasn't clear with "disk".)

I don't think I'll re-release it; it's a very minor thing which most people won't care about. I'll wait till Vim 7.3... or 8... or whatever Bram releases next (if it was something important I'd redo it with the latest patch level, 284).

However, you can do it for yourself easily. Steps to do it:

  1. Edit gVimPortable.nsi, removing "-n " from line 137.
  2. Download, install and run NSIS Portable.
  3. Click on "Compile NSI scripts".
  4. Click on "Load script".
  5. Navigate to gVimPortable.nsi and press OK.
  6. Wait until it's finished.
  7. Start using your new gVimPortable.exe Smile

If you feel like it, you can even bypass steps 2c-5 by dragging gVimPortable.nsi to NSISPortable.exe.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

besonen
Offline
Last seen: 11 years 11 months ago
Joined: 2007-04-21 16:32
recompile and unofficial release hosting

thanks for the step-by-step instructions.

once i recompile it could portableapps.com host it unofficially? i've downloaded many beta portable apps and have often noticed that they are hosted on sites other than portable apps. does portableapps.com have a policy of only hosting official releases?

thanks,
david

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
No

There's no real need for it to be hosted anywhere. No-one else has complained about it. Just do it for yourself and I'll think about how it's best to tackle it for the next release.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

marcmontu
Offline
Last seen: 3 months 3 weeks ago
Joined: 2010-05-25 11:37
Another solution

I've also missed the swap files on gVim portable.

As the '-n' command line option is still present on gVim portable 7.3, it is possible to save the lines below as gVimPortable\Data\settings\_gvimrc, instead of recompiling it for each new version:

"================================================================
" gvimrc file
"================================================================
" This file is needed because gVim portable doesn't use swap files by
" default, as it is called using command line option '-n', which
" cause updatecount option being set to 0:
"
" From :h swapfile
" A swapfile will only be present when |'updatecount'| is non-zero and
" 'swapfile' is set.
"
" From :h updatecount
" 'updatecount' 'uc' number (default: 200)
" global
"
" 'updatecount' is set to zero by starting Vim with the "-n" option,
" see |startup|.
"
" From :h -n
"
" 'updatecount' is set to 0 AFTER executing commands from a
" vimrc file, but before the GUI initializations. Thus it
" overrides a setting for 'updatecount' in a vimrc file, but not
" in a gvimrc file. See |startup|.

set uc=200

besonen
Offline
Last seen: 11 years 11 months ago
Joined: 2007-04-21 16:32
does not appear to work

when i attempted to use this technique with gvimportable 7.3 i did not see any swap files created.

-- david

besonen
Offline
Last seen: 11 years 11 months ago
Joined: 2007-04-21 16:32
where is the 7.3 .nsi file?

the gvimportable.nsi file does not appear to be present in gvimportable 7.3. where can i find the gvimportable 7.3 files that i need in order to recompile with nsis portable?

thanks,
david

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
PAL

gVim Portable now uses the PortableApps.com Launcher which means its configuration is in App\AppInfo\Launcher and that alterations there will not need recompiling. You may remove the flag in there and it'll work fine (you'll need to remove it again after updating, as with the NSIS code technique).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Log in or register to post comments