Wednesday, February 22, 2017

Re: Disabling persistent undo for a file mask

On Wednesday, February 22, 2017 at 12:23:16 AM UTC-6, RingoRangoRongo wrote:
> Hi!
>
>
> In order to disable persistent undo for a file mask I have the following command in my .vimdc:
>
> autocmd! BufRead,BufWrite *.sec setlocal ul=-1
>
> However, I noticed the following strange behaviour:
>
> 1. I save an empty buffer with :saveas file.sec command: no undo file present
> 2. I add text and save this now named buffer with :write command: undo file appears
> 3. I add more text and save this buffer again with :write command: undo file disappears.
>
> How do I escape the appearance of the undo file at the second step? What should I add to my autocmd?
>

What other commands do you have in your .vimrc to enable the undo file for other file types? I'd guess you have an interference going on.

It's probably not related to your current problem, but you probably also want a BufNewFile autocmd event in there.

Also, why are you using "setlocal undolevels=-1" instead of "setlocal noundofile", if you goal is only to disable persistent undo? Setting undolevels to -1 disables undo *entirely*, not just persistent undo, so that pressing 'u' in normal mode while you edit will do nothing.

--
--
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:

Post a Comment