Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php_getset插件中的VIM替换_Php_Regex_Vim_Vim Plugin - Fatal编程技术网

php_getset插件中的VIM替换

php_getset插件中的VIM替换,php,regex,vim,vim-plugin,Php,Regex,Vim,Vim Plugin,我在看一个名为。它为php属性生成getter和setter。虽然它工作得很好,但它不能正确地猜测缩进。我正在努力解决这个问题。有关守则如下: let s:phpname = '[a-zA-Z_$][a-zA-Z0-9_$]*' let s:variable = '\(\s*\)\(\([private,protected,public]\s\+\)*\)\$\(' . s:phpname . '\)\s*\(;\|=[^;]\+;\)' ... (inside a function) let

我在看一个名为。它为php属性生成getter和setter。虽然它工作得很好,但它不能正确地猜测缩进。我正在努力解决这个问题。有关守则如下:

let s:phpname = '[a-zA-Z_$][a-zA-Z0-9_$]*'
let s:variable = '\(\s*\)\(\([private,protected,public]\s\+\)*\)\$\(' . s:phpname . '\)\s*\(;\|=[^;]\+;\)'
... (inside a function)
let s:indent    = substitute(a:variable, s:variable, '\1', '')
let s:varname   = substitute(a:variable, s:variable, '\4', '')
let s:funcname  = toupper(s:varname[0]) . strpart(s:varname, 1)
通过调试,我看到
a:variable
的值为
d$首付(d来自单词“protected”的末尾)。我不明白
substitute
的第三个参数完成了什么。我以前读过反向引用,但我看不出它们在这段代码中做什么


提前感谢您的帮助。请告诉我是否可以让我的问题更清楚或提供更多细节。

[私有、受保护、公共]
是一个字符类,它只匹配单个字符。。。从该列表中:
[private,ocdubl]
(重复字符被忽略)。这可能应该是
\(私有\受保护\公共\
。还有,你的意思是吗?是的,我的意思是回溯。