开发者

How to change all selected chars to _ in Vim

开发者 https://www.devze.com 2023-01-04 00:02 出处:网络
I try to draw a class diagram using Vim. I fill the editor window with white-spaces. Type :match SpellBad /\\s/ to highlight all the white-spaces.

I try to draw a class diagram using Vim.

  • I fill the editor window with white-spaces.

  • Type :match SpellBad /\s/ to highlight all the white-spaces.

  • Ctrl+Q to select vertical white-spaces.

  • Shift+I to insert Bar(|) and then Esc

  • ...........................

  • v+l +... + l to select horizontal white-spaces

But I don't know how to change all selected horizontal white-spaces to underscore(_).

I have to hit _ serval times.

When comes to long horizontal line, it's bad.

  ___________        开发者_如何学Python     ___________               
 |           |           |           |              
 | BaseClass |/__________|  Client   |              
 |___________|\          |___________|              
      /_\                                           
       |                                            
       |____________________________________        
       |                 |                  |       
  _____|_____       _____|_____        _____|_____  
 |           |     |           |      |           | 
 | SubClass1 |     | SubClass2 |      | SubClass3 | 
 |___________|     |___________|      |■■■■■■■■■■■| 

I want a quick method to do this.

Select it -> Change it -> Done!

Maybe map F6 to do it.

Thanks!


After everything you want to change is highlighted, type r_.


There are plenty of tools for making ascii diagrams, and converting them to graphical UML. Why don't you try one of those?

e.g.

http://www.jave.de/

http://ditaa.sourceforge.net/

http://www.diku.dk/hjemmesider/studerende/firefly/stud.html

0

精彩评论

暂无评论...
验证码 换一张
取 消