下面是我的代码片段:
# Get repository of a table:
snippet repo
$$2 = $this->getRepository('${1:Bundle}:${2:TableName}')
${3}当我使用它时,下面是它可能产生的结果:
$Person = $this->getRepository('MyBundle:Person')
$Address = $this->getRepository('MyBundle:Address')我希望第一个是小写的,始终是小写的,并给出如下内容:
$person = $this->getRepository('MyBundle:Person')
$address = $this->getRepository('MyBundle:Address')
...。有没有办法对付狙击手?
发布于 2013-02-10 03:51:29
使用snipMate无法做到这一点。我曾尝试实现这一点,但(特别是当转换改变字符数时),使用当前的实现是不可能的困难。
这可能是迁移到the UltiSnips plugin的最好理由,它是一种现代的、可维护的替代方案(但需要Python支持)。在这里,该功能称为转换,并使用${<tab stop no/regular expression/replacement/options}语法。您可以使用\L正则表达式原子将替换项小写。
发布于 2013-02-10 03:37:42
我认为用snipmate是不可能的,但你可以看看UltiSnips。UltiSnips使用非常相似的模板语法(非常容易转换),并且更加通用。http://www.vim.org/scripts/script.php?script_id=2715
https://stackoverflow.com/questions/14790390
复制相似问题