huilin1990 / zen-coding

Automatically exported from code.google.com/p/zen-coding
0 stars 0 forks source link

Custom #268

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of the product are you using? On what operating system?
Notepad++ on Windows 7

Please provide any additional information below.
I want to add custom snippets/shortcuts for my Zen Coding plugin, how can I do 
so?

Ex. I want to add 'f:${fname}': 'function ${fname}(){\n\t|\n}'
or something like 'php': '<?php\t\t|\t?>'

How can I add that to the plugin, I know its in the Zen Coding.js but I dont 
really understand which part of it should i add it to

Original issue reported on code.google.com by WesleyI...@gmail.com on 11 May 2011 at 4:11

GoogleCodeExporter commented 8 years ago
Search for 'var zen_settings' in this file

Original comment by serge....@gmail.com on 11 May 2011 at 8:16

GoogleCodeExporter commented 8 years ago
can you please go more indepth? I don't understand how to use the variables, 
and when I put a snippet in it doesn't work for some reason.

how would I be able to add something like 'f:${fname}': 'function 
${fname}(){\n\t|\n}'?

Original comment by WesleyI...@gmail.com on 12 May 2011 at 3:06

GoogleCodeExporter commented 8 years ago
No, your 'snippet' should look like this:
`fn': 'function ${id}(){\n\t|\n}'?`

...and used as `fn#myFunctionName`.

1. Snippet name character set is very limited (alphanumeric mostly)
2. Zen Coding syntax is based on CSS, so it accepts some common tokens like #id 
and .class, but you can insert these tokens in output as ${id} and ${class} 
variables respectively

Original comment by serge....@gmail.com on 12 May 2011 at 6:46