Recently I am using Vim to write some small scripts. When writing comments, I want to separate them in this way:
"------------------------------------------------ ---------
"-------------This is Comments ----------------------------
"------------------------------------------------ ---------
I know that ni- can be used to insert n "-" signs, but the middle line needs to be entered manually. Because the content length of Comments is unknown, it needs to be entered manually every time, and sometimes misalignment occurs. I wonder if there is a way to automatically insert enough "-" signs to align with the previous line after entering Comments?
Add this to your vimrc:
Then press <C-r>* when you need to use an asterisk to align with the previous line.
Another solution is to copy all the asterisks in the previous line before writing the text part, and then press gR where you need to write text to enter the virtual replacement mode, so you don’t have to count the asterisks.
.Use of number. .
I don’t know how to do it directly, but there is another way to achieve your needs, and it’s not troublesome:
1. Insert more symbols each time
2. Use block selection to delete redundant symbols at once
Uh~, can you write three asterisks first, jump to the middle, and then press R?