In writing some Vimscript to try to answer this question, I was exploring ways to search for a line with pattern P in position X (P is a search pattern, X is a number).One way to do this would be to search for (e.g.) ^.....[a-z], where [a-z] is the pattern, and 5 is the position.But how would I use Vimscript to make ....., from . and 5?
How do I search for a line that contains a pattern at column n
vimscript;search;regular expression
Simply use regex syntax for repeat n times:/^.\{5}[a-z]This searches for 5 .s and then an [a-z].If you just want to repeat a character c n times, simply do:let dots = repeat('.', 5) dots is now '.....'