How to change all selected chars to _ in Vim
Posted
by Kev
on Stack Overflow
See other posts from Stack Overflow
or by Kev
Published on 2010-06-17T10:30:23Z
Indexed on
2010/06/17
10:33 UTC
Read the original article
Hit count: 228
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.
Ctrl+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.
___________ ___________
| | | |
| 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!
© Stack Overflow or respective owner