Snipmateスニペット内の変数値の大文字と小文字を変更することは可能ですか?
例えば:
snippet dc
def create
@${1} = $1.new
end
出力する必要があります:
def create
@product = Product.new
end
バックティックを使用してカスタム関数を呼び出そうとしました。
snippet dc
def create
@${1} = `ToUpperCase('$1')`.new
end
そして、Vimでこの関数を定義しました:
function! ToUpperCase(str)
let result = substitute(a:str, '\(\w\)', '\u\1', '')
return result
endfunction
Snipmateはバックティックを実行した後、$ n変数を展開しているように見えるため、これは機能しません。