Sunday, May 22, 2011

Re: what are the differences among undofile, swap file, and session file?

Reply to message «Re: what are the differences among undofile, swap file, and
session file?»,
sent 04:00:13 23 May 2011, Monday
by yanzhisheng:

> but after you created a session file, quit Vim, and restart vim and
> reload session file, you can undo the changes if necessary. so I think
> the functions of swap and undofile are included in sesstion file.
And you can swear you tested this with persistent undo off? Session file is a
plain vim script, you can always read it.

Original message:
> >On May 22, 7:46燼m, yanzhisheng <yanzhish...@yahoo.com.cn> wrote:
> >> >> Can somebody can tell me what undofile differs from swap file? and
> >> >> session file. I think session file is very strong! behaves like
> >> >> MATLAB more or less! thanks.
> >> >
> >> >I think the help explains it all. See
> >> >
> >> >:h swap-file
> >> >:h undo-persistence
> >> >:h 21.4
> >>
> >> I have a question, since there is a swap file for every file
> >> that has been read to VIM, and the all changes such as undo/do
> >> would be recorded in the swap file, why needed another file named
> >> undofile? for persistence undo operation, the developers can also
> >> improve vim to save the swap file, so the undofile is not necessary.
> >> is that okay?
> >> thanks.
> >
> >If I understand correctly, the swap file does not contain undo
> >information at all. It simply contains the differences between the on-
> >disk version of the file and the current version being edited. I may
> >be wrong about this.
> >
> >However, the undo file contains the full state of Vim's undo tree. Not
> >just the current undoable changes, but any branch of undoable changes.
> >See http://vim.wikia.com/wiki/Using_undo_branches .
> >
> >A session file is completely unrelated, it has nothing to do with
> >either of these. A session file saves current option settings and
> >mappings, as well as the current buffer/window/tab list. It does not
> >save any changes or undo information.
>
>
> but after you created a session file, quit Vim, and restart vim and
> reload session file, you can undo the changes if necessary. so I think
> the functions of swap and undofile are included in sesstion file.
> thanks

No comments: