Monday, November 28, 2011

Re: Synchronizing or merging undo across platforms

On Sun, Nov 27, 2011 at 11:31 PM, Christian Brabandt <cblists@256bit.org> wrote:
> Hi Bram!
>
> On So, 27 Nov 2011, Bram Moolenaar wrote:
>
>>
>> Christian Brabandt wrote:
>>
>> >
>> > When using a separate 'undodir' directory to store the undofiles, Vim
>> > uses the complete path of the file as filename, replacing the path
>> > separators ('/') by '%'. So far this works as documented by :h
>> > 'undodir'.
>> >
>> > Now when using :rundo with a filename, that contains the complete path
>> > and using '%' as directory separators, those '%' will be replaced by
>> > the current file name (as documented by :h filename-modifiers) and
>> > surprise surprise Vim won't be able to read the undofile.
>> >
>> > So this is just plain wrong in this case. So here is a patch, that
>> > fixes that. This applies only to :rundo and I am not sure, whether
>> > this should also apply to :wundo (I tend not to apply it there) but
>> > this should be kept in mind.
>> >
>> > Bram, please check and apply.
>>
>> In most places where you can use a file name % is expanded.  And it's
>> also useful, especially in the form "%:h" to get the directory.
>
> I don't understand. Using '%' as path separators contradicts the usage
> your pointing out. How am I supposed to :rundo an undofile, that
> contains the '%'-separator?
>

Wouldn't you just escape the '%' characters? fnameescape() should do
it for you I think. So you should just do:

:exec "rundo" fnameescape(undofile(@%))

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

No comments:

Post a Comment