Monday, January 3, 2022

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

On 1/3/22 1:55 PM, Lifepillar wrote:
> On 2022-01-03, Manfred Lotz <ml_news@posteo.de> 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.

Brian

--
--
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/5788e807-ce19-f20c-b356-963c05cf50a9%40gmail.com.

No comments: