Delete the same line in multiple viewports

I like to use vim and vimdiff. I am currently working on comparing two files in vimdiff, and I often come across a situation where I want to delete the same line in both buffers. In the following example, I would like to delete lines 40 and 41.

39 text_a  |   39 text_b
40 text_aa |   40 text_aa
41 text_bb |   41 text_bb
42 text_c  |   42 text_d

It seems tedious to me to execute dd Ctrl-W-W, dd Ctrl-W-Win order to delete a line in the current window, go to another window, delete the line and return to the original window.

Does anyone know a shortcut for this?

+4
source share
1 answer

You can use bufdoto delete lines 40 and 41 in all buffers

:bufdo 40,41d 

according to your case using vimdiff command

:windo 40,41d 
+5
source

Source: https://habr.com/ru/post/1681679/


All Articles