简体   繁体   English

如何在vim正则表达式中展开设置或变量?

[英]How can I expand a setting or variable in a vim regular expression?

I have a regular expression, ^ \\{3,}/ , and want to use the value of a setting or variable in place of the 3 . 我有一个正则表达式, ^ \\{3,}/ ,并希望使用设置或变量的值代替3 Here's the context: 这是上下文:

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

I'd like to use the value of tabstop in place of 3. Alternatively, I could set a new variable to be used. 我想使用tabstop的值代替3.或者,我可以设置一个新的变量来使用。

尝试以下方法而不是match LeadingSpaces /^ \\{3,}/

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM