问题
There are all these great lorem ipsum variations floating around, but no way in hell am I about to go copy and paste them into Sublime Text 2 by hand. I just love Emmet's (lorem100) shortcut too much.
Anyone know how to change the default ipsum to one of these custom ones so Emmet will insert it for me?
回答1:
You can add your own Lorem Ipsum text into Emmet: you should register your own dummy words as a new language.
To add a new language to Lorem Ipsum, create a JS-file in extensions folder with the following content:
emmet.require('lorem').addLang('my', 'collaboratively administrate empowered markets via plug-and-play networks')
The first argument is a language name (it must be a two-letter word), the second argument are space-separated words that will be used to generate a dummy text.
Use this generator as follows: loremmy100
You can also set your dummy text language as default one: simply override lorem.defaultLang
setting in preferences.json, e.g. set it as "lorem.defaultLang": "my"
so you can simply write lorem100
.
回答2:
You can write your own snippet.
<snippet>
<content><![CDATA[
Fromage cheesy feet pecorino. Cheese and biscuits cut the cheese when the cheese comes out everybody's happy melted cheese jarlsberg cheesy feet dolcelatte goat. Cut the cheese cheesecake fondue halloumi dolcelatte cheese and wine macaroni cheese emmental. Halloumi port-salut hard cheese taleggio cheese strings.
Caerphilly who moved my cheese roquefort. Boursin brie chalk and cheese cheese triangles when the cheese comes out everybody's happy cottage cheese stinking bishop goat. Cheese on toast swiss taleggio feta goat queso bavarian bergkase edam. Cottage cheese smelly cheese cheesy grin cut the cheese fondue everyone loves.
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>lorem200</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html</scope>
</snippet>
Now if you write lorem200
in a HTML file and press Tab, you'll get your defined lorem ipsum.
来源:https://stackoverflow.com/questions/19299116/is-it-possible-to-change-the-default-lorem-ipsum-in-emmet