1

Here's my snippet:

# Get repository of a table:
snippet repo
    $$2 = $this->getRepository('${1:Bundle}:${2:TableName}')
    ${3}

When I use it, here's what it may generate:

$Person = $this->getRepository('MyBundle:Person')
$Address = $this->getRepository('MyBundle:Address')

I would like the first one to be lowercase, always lowercase, and give me something like:

$person = $this->getRepository('MyBundle:Person')
$address = $this->getRepository('MyBundle:Address')
...

. Is there a way to do this with the snipmate?

2 Answers 2

1

This cannot be done with snipMate. I've tried to implement this, but (especially when the transformation changes the number of characters), it's impossibly hard with the current implementation.

That may be the best reason to move to the UltiSnips plugin, a modern, maintained alternative (that however requires Python support). There, the feature is called transformation, and uses a ${<tab stop no/regular expression/replacement/options} syntax. You can use the \L regular expression atom to lowercase the replacement.

Sign up to request clarification or add additional context in comments.

1 Comment

I was looking for recursive snippets (snippet in snippet) as well. Many thanks for this information.
1

I don't think it's possible with snipmate but you may have a look at UltiSnips. UltiSnips uses a very similar template syntax (very easy to convert) and is much more versatile. http://www.vim.org/scripts/script.php?script_id=2715

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.