Monday, January 3, 2022

Re: [VIM] Re: [VIM] Re: Persistent undo and swapfile

On 2022-01-03, Brian L. Matthews wrote:
> On 1/3/22 1:55 PM, Lifepillar wrote:
> >On 2022-01-03, Manfred Lotz wrote:
> >>Another point might be interesting. In the undo directory there are
> >>undo files where the real files don't exist any longer. Not sure if
> >>there is some cleanup procedure avalaible.
> >I use this command to remove undo files that haven't changed in a long
> >time:
> >
> > command! -nargs=0 CleanUpUndoFiles !find ~/.vim/tmp/undo -type f -mtime +100d -delete
> >
> >This goes with this setting:
> >
> > set undodir=~/.vim/tmp/undo
>
> You can include undodir in the command:
>
> command! -nargs=0 CleanUpUndoFiles execute '!find "' ..
> fnameescape(&undodir) .. '" -type f -mtime +100d -delete'
>
> (using fnameescape and enclosing it in double quotes probably won't
> be necessary 99.9...% of the time, but just in case...)
>
> There may be better ways to do that, I'm a vim novice, but that works
> for me.

Just remember that &undodir can be a comma-separated list of files,
so while this will work in the common case of 'undodir' containing
only one undo directory, it won't work if 'undodir' contains a list.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220104000824.GD10680%40phoenix.

No comments: