是否有可能在Snipmate片段中更改变量值的大小写?
例如:
snippet dc
def create
@${1} = $1.new
end
Run Code Online (Sandbox Code Playgroud)
应输出:
def create
@product = Product.new
end
Run Code Online (Sandbox Code Playgroud)
我试图使用反引号来调用自定义函数:
snippet dc
def create
@${1} = `ToUpperCase('$1')`.new
end
Run Code Online (Sandbox Code Playgroud)
并在Vim中定义了这个函数:
function! ToUpperCase(str)
let result = substitute(a:str, '\(\w\)', '\u\1', '')
return result
endfunction
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为看起来Snipmate 在执行反引号后扩展了它的$ n变量.