How to fill a line with character x up to column y using Vim -
How can I fill a line with a specific column using a certain column using Vim? For example, imagine, the cursor is on four columns and I want to fill the rest of the line with the remaining line above the 80's dash. How do i do this
There is a function to implement whatever you ask, and a little more.
- This fills the line with its current end of the line, rather than the position of the cursor
- It currently compels a single space between lines and between repeating characters
- This allows you to specify a string to fill the remaining line
The function is defined as follows: < Li> It uses the Vime's textwidth
setting, to determine how much the line And should
"Fill the remaining line with the characters function! Fillain (str)" Wanted to two added to the total length tw = and textwidth if tw == 0 | Let's do two = 80 "To determine the total number of representative" reps = (tw-col ("$") / len (a: str), to calculate the total number of the representative "endiff" strip following trailing spaces. / / [[Space:]] Insert "Insert them, if there is a place, then remove the rear location (though" being forced to be one) "if the representative> 0s / $ / \ = ('' .repeat (a : Str, reps)) / endif endfunction
into your .vimrc
, and make it a mapping, such as
Map & lt; F12 & gt;: Call Philillines ('-')
You can then press F12
to apply the hyphen in the current row
Note: Maybe someone in visual mode It can be easily extended to work on selection, but currently only works for single lines. *
Comments
Post a Comment