How can I extend a parameter or variable in a vim regex?

I have a regex ^ \{3,}/ , and I want to use the value of a parameter or variable instead of 3 . Here's the context:

 match LeadingSpaces /^ \{3,}/ highlight LeadingSpaces ctermbg=red guibg=red 

I would like to use the tabstop value instead of 3. Alternatively, I could set a new variable to be used.

+6
source share
1 answer

Try the following instead of match LeadingSpaces /^ \{3,}/ :

 execute 'match LeadingSpaces /^ \{'.&tabstop.',}/' 
+7
source

Source: https://habr.com/ru/post/915828/


All Articles