On Fri, Nov 18, 2011 at 2:17 PM, Paul <[email protected]> wrote:
> Interesting about filename-modifiers! But I have one more issue.
>
> On Nov 17, 3:29 am, "Christian Brabandt" <[email protected]> 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 '%'.
>
> What would be better is if Vim could be configured to use something
> other than the complete path as the filename. The current behavior
> seems to be to use the complete path for any undodir setting other
> than "." This makes it impossible to share undo files across
> platforms. What would it take to fix this?
>

I think :rundo and :wundo were created for this purpose. From :help :rundo,

You can use these in autocommands to explicitly specify the name of the
history file.  E.g.: >

        au BufReadPost * call ReadUndo()
        au BufWritePost * call WriteUndo()
        func ReadUndo()
          if filereadable(expand('%:h'). '/UNDO/' . expand('%:t'))
            rundo %:h/UNDO/%:t
          endif
        endfunc
        func WriteUndo()
          let dirname = expand('%:h') . '/UNDO'
          if !isdirectory(dirname)
            call mkdir(dirname)
          endif
          wundo %:h/UNDO/%:t
        endfunc

You should keep 'undofile' off, otherwise you end up with two undo files for
every write.

You can use the |undofile()| function to find out the file name that Vim would
use.

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

Reply via email to