Thursday, November 22, 2018

Re: Noswap and Nobackup when editing python on a specific device (mounted) on Linux

On Thu, Nov 22, 2018 at 9:21 PM Gary Johnson <garyjohn@spocom.com> wrote:
>
> On 2018-11-22, tuxic@posteo.de wrote:
> > Hi,
> >
> > from time to time I have to edit a python file, which
> > is stored on the 2M flash memory on a microcontroller
> > board.
> >
> > To avoid unneccassary write cycles to the flash (flash wear out)
> > I want to disable backup and swapfile in such a case.
> >
> > And to ensure both are switched off even if I have forgotten
> > to do so, vim should do that automatically.
> >
> > I am working under Linux.
> >
> > The mountpoint for the flash (the microcontroller represents
> > itsself as "USBstick" with 2M memory space...) is
> > /home/user/flash and I am always editing python code.
[...]

'backup' and 'writebackup' are global options, so disabling them for
one file disables them for every file. If that's what you want, you
can set them off in your vimrc. However, ":set nobackup writebackup"
is supposed to leave nothing hanging around once the write has
succeeded.

For 'swapfile', which is buffer-local, it is easier. I suggest the
following (untested):

autocmd BufNewFile,BufReadPre /home/user/flash/**/* setlocal noswapfile

Best regards,
Tony.

--
--
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/d/optout.

No comments: