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

前端 未结 14 1757
刺人心
刺人心 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:08

    There is a plugin, based on different answers here: https://github.com/gangleri/vim-diffsaved

    It provides the :w !diff % - method and the more involved diffthis one.

    Apart from that undotree allows this as well, but also much more (diffs between different undo checkpoints). Similar to Gundo.

提交回复
热议问题