如何在 vim 正则表达式中扩展设置或变量? [英] How can I expand a setting or variable in a vim regular expression?

查看:21
本文介绍了如何在 vim 正则表达式中扩展设置或变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正则表达式,^ \{3,}/,并且想要使用设置或变量的值来代替 3.这是上下文:

I have a regular expression, ^ \{3,}/, and want to use the value of a setting or variable in place of the 3. Here's the context:

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

我想使用 tabstop 的值代替 3.或者,我可以设置一个要使用的新变量.

I'd like to use the value of tabstop in place of 3. Alternatively, I could set a new variable to be used.

推荐答案

尝试以下代替 match LeadershipSpaces/^ \{3,}/:

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

这篇关于如何在 vim 正则表达式中扩展设置或变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆