Vimdiff: How to put all changes inside a particular function from one file to another?

…衆ロ難τιáo~ 提交于 2019-12-04 03:21:48

You can use a visual selection and the ex command :diffget/:diffput

So, for example to get the changes for just the current insides of a code block ( { ... } )

Vi}:diffget<Enter>

To put the changes for the two enclosing levels including the lines with the brackets:

V2a}:diffput<Enter>

Note that since these are ex commands the motions are linewise. Of course, you could use any range, so you can repeat the visual range, or use markers

:'a,'bdiffput

etc. Use your imagination, this is vim :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!