Can I see changes before I save my file in Vim?

前端 未结 14 1805
刺人心
刺人心 2020-12-07 07:33

I use Vim. I open a file. I edit it and I want to see what I\'ve edited before I save it.

How can I do this in Vim?

14条回答
  •  悲哀的现实
    2020-12-07 08:04

    from vimrc_example.vim:

    " Convenient command to see the difference between the current buffer and the
    " file it was loaded from, thus the changes you made.
    if !exists(":DiffOrig")
      command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
              \ | wincmd p | diffthis
    endif
    

提交回复
热议问题