How to run command over multiple buffers/tabs to remove trailing spaces?

后端 未结 2 2167
不知归路
不知归路 2020-12-28 21:26

I have a command to tidy up excessive whitespace in my code in vim:

\" to tidy excess whitespace
map 1 :execute \':%s#\\s\\+$##g\'
         


        
2条回答
  •  一个人的身影
    2020-12-28 21:55

    See this vim tip on using bufdo, windo, and tabdo.

    Assuming all your buffers are in the buffer list, your map could be as simple as

    " to tidy excess whitespace
    map 1 :execute ':bufdo! %s#\s\+$##g'
    

提交回复
热议问题