20 Sep, 2008, Lobotomy wrote in the 1st comment:
Votes: 0
Just starting to get the hang of using vim now, due to its ability to read compressed .gz files, and I've come across a particular snag. It seems that when I edit and save a .gz file, a backup file is created of the original with the prefix ".gz~". I'm fine with that, except that it seems that vim's automatic gz reading only triggers on files actually ending in ".gz"; trying to read the ".gz~" file results in the binary gibberish you get when trying to read a gz file with a regular editor (like pico/nano). :sad:

Anyone know of a solution to this, or would I be forced to rename the backup file to a seperate ".gz" file in order to read from it? It's a little irksome as the latter would present a major inconvenience. :mad:
20 Sep, 2008, Chris Bailey wrote in the 2nd comment:
Votes: 0
You can change the backup extension but I'm not sure if that would help.
:set backupext=.backup


That would for instance make a backup of the file foo.gz be saved as foo.gz.backup. Maybe if you play around with it a bit you could figure something out. Maybe if you set a backup directory for vim and leave the backupext blank it will make a standard copy in the directory your specify? I'm on my windows laptop right now and can't try it out.
20 Sep, 2008, Fizban wrote in the 3rd comment:
Votes: 0
Maybe ~.gz It's then save it to file.gz~.gz not pretty but it might allow it to read it.
20 Sep, 2008, Chris Bailey wrote in the 4th comment:
Votes: 0
Good point Fiz. That might just work. Maybe check with some of the settings in _vimrc also.
20 Sep, 2008, David Haley wrote in the 5th comment:
Votes: 0
How often are you even reading the backup file? (Do pico/nano generate a backup in the first place?) FWIW I don't generate backups at all – I use version control to do that…
20 Sep, 2008, quixadhal wrote in the 6th comment:
Votes: 0
I also disable backups. VIM already makes a temp file which tracks every editing command you do until you save/exit, and that file can be used to recover your changes if you get disconnected mid-edit (using vim -r). That's good enough for me.

My .vimrc file has "set nobackup" and "set nowritebackup" both. Oh, and you might find "set noerrorbells" and "set novisualbell" helps you stay sane. :)
20 Sep, 2008, Lobotomy wrote in the 7th comment:
Votes: 0
DavidHaley said:
How often are you even reading the backup file? (Do pico/nano generate a backup in the first place?) FWIW I don't generate backups at all – I use version control to do that…

I don't make a habit of remembering how often I look at backup files, but I'd say I probably do it relatively often as I use cp to create backups of some files sometimes when I'm modifying something and I have reason to suspect that the change will end up being a bad idea or otherwise result in a catastrophic failure of some sort. Also, pico/nano won't actually create backups, at least as far as my experience has been, but that hasn't been a problem for me so far. As for version control, I'm not a big fan of CVS; assuming that's what you mean, anyways.

quixadhal said:
I also disable backups. VIM already makes a temp file which tracks every editing command you do until you save/exit, and that file can be used to recover your changes if you get disconnected mid-edit (using vim -r). That's good enough for me.

My .vimrc file has "set nobackup" and "set nowritebackup" both. Oh, and you might find "set noerrorbells" and "set novisualbell" helps you stay sane. :)

I'm not sure if I'll be able to modify vim to do so, as I'm hosted on a remote shell service (again, my knowledge of *nix is somewhat limited so I could be wrong here), but I'll give it a shot here in a moment and see how it goes.

Also, even though VIM looks particularly interesting where its code syntax recognition whatnot is concerned, I don't really see myself actually using it to write code. I'm perfectly happy using pico/nano for that. I think at the moment the only use it'll see from me is just viewing or modifying compressed files.
20 Sep, 2008, David Haley wrote in the 8th comment:
Votes: 0
If you previously did backups with 'cp', and pico/nano didn't do it for you, then it seems that disabling backups entirely in vim won't be changing the status quo… :wink:

By version control I mean any kind of version control – I use bzr myself. Why don't you like CVS?

And what Quix meant is that you can put those commands into your .vimrc file, no need to modify vim itself.
20 Sep, 2008, Lobotomy wrote in the 9th comment:
Votes: 0
DavidHaley said:
If you previously did backups with 'cp', and pico/nano didn't do it for you, then it seems that disabling backups entirely in vim won't be changing the status quo…

Well, it's just that I prefer to be the one deciding when a file needs to have a backup or not. The files I use vim on are mere data files, and I tend to make backups of them far less frequently than code files (which I don't use vim on), so in the end it works better for me to have vim's auto backup feature disabled; especially since I can use cp to create a backup ending in .gz that vim will still be able to read.

Fizban said:
Maybe ~.gz It's then save it to file.gz~.gz not pretty but it might allow it to read it.

Yes, that actually did work. Thanks. Although, in the end I just opted to disable backups entirely regardless.

I appreciate everyone's help so far. It's been very useful. :smile:
0.0/9