Tuesday, February 11, 2014

Re: Switch off .swp-files and backup files only when editing a certain file

On 2014-02-12, meino cramer wrote:
> Hi,
>
> I want to swicth off vim (good!) behaviour of creating a backup file
> (*~) and a swap file (*.swp) in way, that they not only will created
> and deleted afterwards, but the should not created in first place at
> all.
> ....and this should only happen, when a cerain file (path+filename as
> identification) will be edited.
>
> Background:
> The certain file is the configuration file of a small embedded device,
> which I can mount like an usbstick.
> If I will forget to delete those files afterwards, I will screw up
> this little thing.
>
> How can I do this?

For the backup file, you can add the path to your file to the
'backupskip' option.

For the swapfile, you just need to reset 'swapfile' in the buffer
containing your file. I think the following will work.

au BufNewFile,BufRead /path/to/your/file setlocal noswapfile

Note that I have not tested any of that. I just read some help
entries and it seems like those ought to work. See

:help 'backupskip'
:help 'swapfile'

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: