759 Commits

Author SHA1 Message Date
mattn
26954b92cd Fixes tests 2014-12-17 17:26:49 +09:00
mattn
47b54c2e5e Fixes against errors/warnings in vint 2014-12-17 17:26:10 +09:00
mattn
edf74342b5 Merge branch 'master' into wip 2014-12-17 16:09:57 +09:00
mattn
cd09765a83 use_selection = 0 in default 2014-12-17 16:09:20 +09:00
mattn
5bfcf0abfd wip 2014-12-17 03:59:40 +09:00
mattn
1c1c511896 Update css abbreviations 2014-12-17 03:31:12 +09:00
mattn
0e08b66e6c Replace all 2014-12-17 03:14:59 +09:00
mattn
62b3accc20 Check maprg too 2014-12-16 19:09:02 +09:00
mattn
9ac3339942 WIP: implement selection 2014-12-16 19:08:49 +09:00
mattn
2a8f0e094d lang/charset should be in variables of configuration 2014-12-11 14:27:46 +09:00
mattn
2b4eea8775 hasmapto should be used to check key-mapping instead of plug-mapping 2014-12-09 18:00:01 +09:00
mattn
76499f48b8 Remove badge 2014-12-08 20:33:45 +09:00
mattn
0d63cc76aa Merge pull request #235 from kashiro/issues234
add link:import for webcomponents #234
2014-11-27 01:48:28 +09:00
mattn
8b703a0a00 Fixes errors on lint. #236 2014-11-06 20:02:36 +09:00
mattn
4b17969f5a Markdown 2014-11-05 19:36:29 +09:00
tomoyuki kashiro
3e668b3523 add link:import for webcomponents #234 2014-11-03 17:43:09 +09:00
mattn
485abffe6c Add test to expand dn to 'display: none' for css 2014-10-09 09:47:40 +09:00
mattn
4d78123db9 Find snippet more fuzzy. Close #212 2014-10-09 09:45:47 +09:00
mattn
920904c53b Version bump up 2014-09-03 09:13:16 +09:00
mattn
a3418eb419 Merge branch 'master' of github.com:mattn/emmet-vim 2014-09-02 18:35:06 +09:00
mattn
070800e31d Support 's' filter. Close #231 2014-09-02 18:33:26 +09:00
mattn
e9b90c7f90 Merge pull request #230 from UncleBill/master
use two dollars to escape $
2014-08-31 14:48:54 +09:00
UncleBill
def1f1aead escape $ 2014-08-29 22:16:14 +08:00
mattn
55c704bc3a fl should be expanded float:left; in css. close #225 2014-08-08 18:49:35 +09:00
mattn
591bfc99dc Fix tests 2014-08-06 16:07:42 +09:00
mattn
d51cb7141f Merge pull request #223 from sheoak/master
Sass not working properly with sass extension
2014-08-06 15:59:27 +09:00
mattn
c0175decd3 Fix attribute parse 2014-08-06 15:57:59 +09:00
mattn
bd5f03bb24 Fix #224 2014-08-06 15:42:04 +09:00
sheoak
105bea22b8 Merge branch 'master' of https://github.com/mattn/emmet-vim 2014-08-04 15:07:09 +02:00
sheoak
f1a34ccaa3 Fixes issue #211 - sass not working properly because expecting braces instead of tabs 2014-08-04 15:05:40 +02:00
mattn
39d8f88ccd Remove debug code 2014-08-04 12:21:02 +09:00
mattn
bd6060ba91 Workaround for sass, fixes #222 2014-08-04 11:46:54 +09:00
mattn
a61cb0c138 Merge pull request #221 from mvz/fix-vundle-instructions
Fix Vundle instructions
2014-07-24 20:17:26 +09:00
Matijs van Zuijlen
92fa2e568f Fix Vundle instructions
- Fix syntax to work in .vimrc
- The Bundle command is being renamed to Plugin (although Bundle still
  works for now)
2014-07-24 08:13:18 +02:00
mattn
2b94508a46 div[foo bar] should be expanded into <div foo="" bar=""></div>. close #218 2014-07-18 20:29:28 +09:00
mattn
dcf247fb5c Fix test 2014-07-18 20:15:22 +09:00
mattn
3874d6210d Merge branch 'master' of github.com:mattn/emmet-vim 2014-07-18 20:14:55 +09:00
mattn
23aea8c21a Revert 08eb534c42, because test is failing 2014-07-18 20:14:08 +09:00
mattn
00536daaf6 Merge pull request #217 from conraddecker/master
Changed 'parenthesis' setting to 'attribute_style' setting
2014-07-18 17:27:31 +09:00
mattn
0f45689b81 Set attributes. fix #218 2014-07-18 13:13:54 +09:00
mattn
beeb159626 Merge pull request #219 from typoon/master
Small fix related to VIM Tip #436
2014-07-18 12:59:16 +09:00
gilgamesh
08eb534c42 Small fix related to VIM Tip #436
http://vim.wikia.com/wiki/Recover_from_accidental_Ctrl-U

Suppose you do the following:

div.foo.bar.baz<c-y>,

This will be expanded to <div clas="foo bar baz"></div>

Then you realize that you wanted yyy instead of baz. You press ESC and
u and notice that you don't have your original string in the undo log
(div.foo.bar.baz).

This patch fixes this behaviour.
2014-07-17 16:47:41 -03:00
Conrad Decker
437cd92004 Changed 'parenthesis' setting to 'attribute_style' setting to allow for choice between 'hash' and 'html'
Updated output to correctly display html-style attributes or hash-style attributes. 'attribute_style' setting defaults to hash but can be updated by the user to use html style attributes
2014-07-17 09:40:35 -04:00
mattn
761adcc4be Fix typo 2014-07-17 09:35:04 +09:00
mattn
ca6296fb7f parenthesis for haml #216 2014-07-17 09:23:28 +09:00
mattn
96903b0913 Merge pull request #215 from shaabhishek/master
Added meta viewport tag
2014-06-28 23:47:44 +09:00
abhishek
949b8c26b7 Added meta viewport tag 2014-06-28 15:36:26 +09:00
mattn
320bb97cb4 Merge pull request #213 from sevko/master
Document g:user_emmet_leader_key's trailing ','.
2014-06-25 13:56:16 +09:00
Severyn Kozak
23bb8c0175 Document g:user_emmet_leader_key's trailing ','.
README.mkd, doc/emmet.txt
	-Add some text to clarify that any keymap specified with
	`g:user_emmet_leader_key` must be followed by a `,`.
2014-06-25 00:23:20 -04:00
mattn
39a5ba0eca Add test for #210 2014-06-06 13:50:23 +09:00
mattn
ef3f51ba44 Parse as css 2014-06-06 13:50:23 +09:00
mattn
da9283aa5c Don't handle @i for @i {} 2014-06-06 13:50:22 +09:00
mattn
7ac6a8acb8 Fix tests 2014-06-06 13:50:21 +09:00
mattn
ef27d24df0 Fix #210 2014-06-06 13:50:21 +09:00
mattn
c49d4567dc Fix default attributes 2014-06-06 13:50:20 +09:00
mattn
7711bf1f15 Merge pull request #209 from deepflame/master
change shortcut description
2014-05-26 10:36:03 +09:00
Andreas Böhrnsen
fe38681354 maybe this is better 2014-05-26 00:31:05 +08:00
Andreas Böhrnsen
5d73777a65 small update to docs to make shortcut clearer 2014-05-26 00:28:12 +08:00
mattn
3ccd466123 Fix #207 2014-05-19 15:13:34 +09:00
mattn
018a97523a Merge pull request #205 from richardscollin/patch-1
Typo in doc
2014-05-14 11:59:47 +09:00
Collin Richards
b3c346c54d Typo in doc
Changed two closing li tags to div tags.
2014-05-13 22:53:28 -04:00
mattn
fbd353387b Add c# for expanding color: ; 2014-05-07 10:09:37 +09:00
mattn
e185c13171 s/7/8/ 2014-05-07 10:05:47 +09:00
mattn
e18077e991 Fixed #203 2014-05-01 13:41:40 +09:00
mattn
ff1aaf88a9 Fixes behavior of removeTag 2014-04-14 09:38:12 +09:00
mattn
2b6f37f470 Fix balance tag 2014-04-14 09:20:02 +09:00
mattn
74055488de Try more candidates. 2014-04-13 01:12:12 +09:00
mattn
6adab8a234 Use indent getting from configuration, Fix #201 2014-04-03 01:36:28 +09:00
mattn
19961fc270 Fix #199 2014-03-28 22:13:51 +09:00
mattn
ed36e194e5 Wrap what you see when leader contains {$#} 2014-03-28 22:00:01 +09:00
mattn
5916ad27fa update doc 2014-03-27 09:25:00 +09:00
mattn
b00cf4d33f Update doc 2014-03-27 09:06:15 +09:00
mattn
0511be8ac5 Merge pull request #198 from ctruett/master
Edited line 110 of autoload/emmet.vim to fix intelligent expansion. It w...
2014-03-26 10:58:50 +09:00
Christopher Truett
e8169335a5 Edited line 103 of autoload/emmet.vim to fix intelligent expansion. It was trying to call a non-existant command. 2014-03-25 20:03:32 -04:00
mattn
6577e0e687 Guard attributes 2014-03-16 00:05:57 +09:00
mattn
2f0bd7d02e Add test for #195 2014-03-15 22:50:29 +09:00
mattn
56634e7f80 Fixes #195 2014-03-15 22:47:52 +09:00
mattn
ef3b75e877 comment_type 2014-03-14 13:51:27 +09:00
mattn
43e940a660 Fix doc 2014-03-12 17:41:54 +09:00
mattn
7005655302 Fix typo 2014-03-12 17:08:06 +09:00
mattn
d894c67aa9 remove \<right> 2014-03-11 21:41:17 +09:00
mattn
7268e203b8 upper case 2014-03-11 21:07:53 +09:00
mattn
cd23a38f2b <!DOCTYPE> should be contains last \n 2014-03-11 21:07:07 +09:00
mattn
9480824c0f Find snippet recursibly 2014-03-11 17:18:17 +09:00
mattn
464291244a Remove debug message 2014-03-11 17:17:29 +09:00
mattn
c087cff8ff Add test for update tag 2014-03-11 17:16:58 +09:00
mattn
6d2c6a1de4 Add test for RGBa syntax 2014-03-11 17:07:22 +09:00
mattn
fef441fa71 New emmet feature: RGBa syntax 2014-03-11 17:01:31 +09:00
mattn
cd808a5fe5 New emmet feature: update tag 2014-03-11 16:39:35 +09:00
mattn
9b80875e07 bump up version 2014-03-10 11:19:02 +09:00
mattn
52545221f6 Save/restore cursor position for removing $cursor$. related issue #162 2014-03-10 11:13:39 +09:00
mattn
72610878e4 Use dash 2014-03-06 09:09:57 +09:00
mattn
7f0521f094 Use dash 2014-03-06 09:08:50 +09:00
mattn
fb11bd8b28 Add test 2014-02-13 17:21:38 +09:00
mattn
7aa1ff965a script[jquery.js] 2014-02-13 17:20:46 +09:00
mattn
49cb1c2884 Fix default attributes 2014-02-13 17:15:59 +09:00
mattn
19395caea7 Fix default attribute 2014-02-13 17:01:59 +09:00
mattn
ba56b91719 unlet Val 2014-02-13 16:48:27 +09:00
mattn
dc8b589cd0 Take two arguments for lg(xx,xx) 2014-02-13 16:46:08 +09:00
mattn
2f1e60f4fe Add default attributes(emmet v1.1beta) 2014-02-13 16:32:20 +09:00
mattn
381dd35018 Improve cursor position after expanding for sass 2014-02-12 20:53:22 +09:00
mattn
d9481c235b Fix sass indentation 2014-02-12 20:47:26 +09:00
mattn
6cd20746ad Fixes indentation bug. Closes #189 2014-02-12 20:25:03 +09:00
mattn
554e0c02f5 Look Content-Type for ^YA. closes #188 2014-02-05 18:41:20 +09:00
mattn
afb2086306 Merge pull request #181 from josephjaber/patch-1
Fix Vundle installation link in README.md
2013-12-19 15:45:13 -08:00
Joseph Jaber
8989b0a49c Fix Vundle installation link in README.md
Fix markdown in Vundle installation section that caused the link to be formatted incorrectly.
2013-12-19 11:47:16 -05:00
mattn
ddbbe81d09 Update README, related issue #148 2013-12-13 20:25:26 +09:00
mattn
2e365c9573 Fixes #139 2013-12-13 20:22:59 +09:00
mattn
576679e023 Merge pull request #179 from qp123asd/master
Add less support,and fix scss typo.
2013-12-12 15:56:49 -08:00
weirongxu
936d5c6c2f Add less support,and fix scss typo. 2013-12-13 02:29:52 +08:00
mattn
df3e61ba69 Fixes #178 2013-12-06 20:31:43 +09:00
mattn
934feeb55f Add bem filter: http://docs.emmet.io/filters/bem/ 2013-12-06 17:06:14 +09:00
mattn
fee5b34b5f ... 2013-11-29 21:07:53 +09:00
mattn
262777309f Customizable quote char 2013-11-29 20:13:26 +09:00
mattn
d2d6a9f385 Merge pull request #166 from zytron/filetype_detection
Changed emmet#getFileType() to do basetype checking on &ft parts
2013-11-29 01:17:22 -08:00
mattn
8aeb24fa77 Fix name of function 2013-11-28 09:44:15 +09:00
mattn
2ecc25f727 Fixes #173 2013-11-28 09:39:26 +09:00
mattn
47f27f8c3d Fixies #172 2013-11-26 16:22:37 +09:00
mattn
e990cebbae Workaround 2013-11-26 12:49:45 +09:00
mattn
48373cbf0a Ooooos 2013-11-26 12:37:47 +09:00
mattn
d6ab310cc9 Fixes rendering type 2013-11-26 09:58:41 +09:00
mattn
fb096ac4d4 Support boolean attributes, related issue #170 2013-11-25 01:36:12 +09:00
mattn
8c1e42340d Closes popup if displayed 2013-11-22 14:50:56 +09:00
mattn
f3e6cc72a3 version bump up 2013-11-21 15:05:08 +09:00
mattn
5a37a6ef26 Closes popup 2013-11-21 12:46:11 +09:00
Bill Hau
59239b05bb Changed emmet#getFileType() to do basetype checking on &ft parts instead of empty type var 2013-11-15 20:15:41 +09:00
mattn
135fb40b27 Merge pull request #169 from minimul/readme-pathogen-update
Pathogen defacto standard is to use 'git clone'. Moreover, the 'unzip /p...
2013-11-14 15:58:52 -08:00
Christian
55eb236bd8 Revert back to https:// url type as this is Github's recommended type. See http://stackoverflow.com/questions/11041729/why-does-github-recommend-https-over-ssh 2013-11-14 15:31:16 -05:00
Christian
e058f514a5 Pathogen defacto standard is to use 'git clone'. Moreover, the 'unzip /path/to/emmet-vim.zip' command does not work because a parent directory (e.g. emmit-vim) needs to be created within the ~/.vim/bundle dir for vim to pickup the plugin correctly. Lastly, use the SSH url as it is the cloning default standard. 2013-11-13 16:59:58 -05:00
mattn
55c0875505 Merge pull request #167 from mattkatz/patch-1
Adding instructions for using Vundle
2013-11-06 19:22:14 -08:00
mattkatz
d60db48777 Adding instructions for using Vundle
Vundle is like pathogen but just an eeeensy bit better.
2013-11-06 19:17:00 -05:00
mattn
b8569d50f4 map keys for the buffer. related issue #163 2013-11-01 18:06:30 +09:00
Bill Hau
b5ea573744 Changed emmet#getFileType() to do basetype checking on &ft parts instead of empty type var 2013-10-31 13:52:52 +00:00
mattn
313a58d55c Remove all quotes. related issue #155 2013-10-31 08:42:29 +09:00
mattn
3c5eb601fb Add !!! 2013-10-29 22:41:33 +09:00
mattn
f82d715caa Possible to specify !!! 2013-10-29 22:18:15 +09:00
mattn
ac79b721c5 Add 'c' for comment 2013-10-29 22:09:06 +09:00
mattn
a765fe7b82 imageSize for css. related issue #155 2013-10-25 22:57:42 +09:00
mattn
036b37fb64 Added test for #164 2013-10-22 13:24:50 +09:00
mattn
c9b8c2edcb Fixes item number in group. Closes #164 2013-10-22 13:21:32 +09:00
mattn
57de05e041 Update README 2013-10-22 12:02:00 +09:00
mattn
ea1b779868 s/ExpandWord/expandWord/g
s/CompleteTag/completeTag/g
Ready for next/prev item
2013-10-22 12:00:04 +09:00
mattn
ed7ab5fd49 user_emmet_install_global to off to install as global 2013-10-22 11:59:42 +09:00
mattn
c588b72fc1 Merge pull request #160 from eugene-p/master
lorem did not pick up count always defaulting to 30
2013-10-17 17:26:45 -07:00
Yauheni(Eugene) Patsiomkin
c78a2ff435 lorem did not pick up count always defaulting to 30 2013-10-17 15:41:42 -06:00
mattn
6baf3c1210 Expand | just for snippets 2013-10-15 10:21:24 +09:00
mattn
c1691caa6a Fixes tests 2013-10-15 10:21:05 +09:00
mattn
4c371b5fa6 Added emmet#expandAbbrIntelligent() to you to do:
imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
2013-10-15 09:26:25 +09:00
mattn
32a1dac905 Added emmet#isExapandable(). related issue #156 2013-10-15 09:13:07 +09:00
mattn
ef2cd77d40 Fixes parsing brackets. closes #157 2013-10-14 22:11:34 +09:00
mattn
0f2a0ed1e8 Fixes test 2013-10-14 22:11:26 +09:00
mattn
89dd2b7e71 Badge 2013-10-02 11:28:08 +09:00
mattn
6a06f58a5e Remove annoying type="text/css" from link:css and link:print snippet. Closes #152 2013-10-01 09:31:40 +09:00
mattn
445ca239ad Remove debug comment 2013-09-26 09:59:47 +09:00
mattn
bd4c1bfaef Expand paren when type is css 2013-09-26 09:57:06 +09:00
mattn
f8095a65dd Expand paren 2013-09-25 22:56:34 +09:00
mattn
9c17334509 Get image paths that is relative location from the current buffer. Related issue #150 2013-09-19 02:03:00 +09:00
mattn
9475526c1f Possible to disable definition of :Emmet command. Closes #147 2013-09-10 19:42:21 +09:00
mattn
5d90a2c83d Restore cursor position on insert-mode 2013-09-09 21:19:38 +09:00
mattn
a5313498d7 No need to capture submatches 2013-09-02 16:32:15 +09:00
mattn
8f1775cf02 <html lang="ja></html> can't toggle comment 2013-08-27 19:34:08 +09:00
mattn
44af2e417d Fixes toggle comment. <meta charset="utf-8"> make it hang 2013-08-27 12:41:59 +09:00
mattn
fcf0f567be Use i_CTRL-R= instead of <esc>a 2013-08-25 23:53:36 +09:00
mattn
ebba5bf1e2 Fuzzy search 2013-08-25 01:30:21 +09:00
mattn
e8e9877cfc Fixes tests 2013-08-22 20:32:01 +09:00
mattn
9d7a3d4a44 Add new option g:emmet_docroot to specify map of document root.
let emmet_docroot = {
\  'c:/dev/vim-jp.github.com/': 'http://vim-jp.org/',
\  'c:/dev/mattn/': 'http://mattn.kaoriya.net/',
\}

When getting image size of '/path/to/file.jpg' and current html file is
'c:/dev/mattn/foo/bar/index.html', the image file will be treated as:

  http://mattn.kaoriya.net/path/to/file.jpg
2013-08-22 20:12:49 +09:00
mattn
13994cc066 html5ish 2013-08-22 19:55:53 +09:00
mattn
afd55ad70c Check foldclosed 2013-08-22 19:44:51 +09:00
mattn
056b49c2bd Fixes basedirect/basevalue ex: ul>li.item$@-*5 Should be count down from 5 to 1. 2013-08-20 09:44:29 +09:00
mattn
f2fc51391c Updated docs 2013-08-19 11:07:19 +09:00
mattn
b2561af319 Possible to specify base value. Related issue #144 2013-08-19 11:07:19 +09:00
mattn
6016cf6bdd Merge pull request #141 from drakmail/patch-1
Add basic github-flavored markdown syntax highlighting to README.mkd
2013-08-14 10:47:04 -07:00
mattn
61360ddfdc Add fuzzy search for css. Fixes #142 2013-08-14 13:04:59 +09:00
Alexander
4ab27087f9 Backticks for code blocks 2013-08-13 17:29:29 +04:00
Alexander
6ad2017568 Add basic github-flavored markdown syntax highlighting to README.mkd 2013-08-13 17:19:22 +04:00
mattn
49d2c8280f version bump up 2013-08-13 21:29:01 +09:00
mattn
58c9a51322 Add note for <plug> mapping 2013-08-13 21:18:31 +09:00
mattn
f7a8cce3d5 Unity <plug> mapping names 2013-08-13 21:18:16 +09:00
mattn
a726fe44c8 Merge pull request #137 from DeaR/fix-duplicate-key
Fix duplicate key.
2013-08-13 04:44:44 -07:00
mattn
286869545f Shouldn't be a leading spaces 2013-08-13 20:42:25 +09:00
mattn
5dc6c1a001 Include feature of #129 2013-08-13 20:42:01 +09:00
mattn
57a2ca0e2f Add test for sass indentation bug 2013-08-13 20:21:37 +09:00
mattn
888fdb6699 Fixes sass indentation 2013-08-13 20:16:23 +09:00
mattn
9be8926559 Fixes wrong tests for sass 2013-08-13 18:59:31 +09:00
mattn
8f088c9f73 Add emmet#getFilter() 2013-08-13 18:59:13 +09:00
mattn
c257e09d69 Fixes extends of filter. sass filter doesn't extend css's one 2013-08-13 18:44:42 +09:00
mattn
f18cb41f93 Merge branch 'master' of github.com:mattn/emmet-vim 2013-08-12 22:39:15 +09:00
mattn
40c4b1e0b8 Fixes test 2013-08-12 22:38:45 +09:00
mattn
f1cbe2545f identity can treat URL 2013-08-12 22:38:05 +09:00
mattn
018cab0adc Merge pull request #139 from mikewadsten/master
Fix numbering on nested multiplication
2013-08-12 06:28:53 -07:00
Mike Wadsten
2a5684bac4 Fix numbering on nested multiplication
If an element is being multiplied, its number should reflect the repeating of that element, not the group it belongs in.

----
Example case:

Input: .outer$*3>.inner$*2

Expected output:
<div class="outer1">
  <!-- two DIVs: .inner1, .inner2 -->
</div>
<div class="outer2">
  <!-- two DIVs: .inner1, .inner2 -->
</div>
<div class="outer3">
  <!-- two DIVs: .inner1, .inner2 -->
</div>

Observed output:
<div class="outer1">
  <!-- two DIVs: .inner1, .inner2 -->
</div>
<div class="outer2">
  <!-- two DIVs: .inner2, .inner2 -->
</div>
<div class="outer3">
  <!-- two DIVs: .inner3, .inner3 -->
</div>
2013-08-12 22:28:29 +09:00
mattn
cb869edec4 Add test for #140 2013-08-12 22:27:13 +09:00
mattn
222c509447 Fixes #140 2013-08-12 22:18:11 +09:00
Mike Wadsten
cca5dedd69 Fix numbering on nested multiplication
If an element is being multiplied, its number should reflect the repeating of that element, not the group it belongs in.

----
Example case:

Input: .outer$*3>.inner$*2

Expected output:
<div class="outer1">
  <!-- two DIVs: .inner1, .inner2 -->
</div>
<div class="outer2">
  <!-- two DIVs: .inner1, .inner2 -->
</div>
<div class="outer3">
  <!-- two DIVs: .inner1, .inner2 -->
</div>

Observed output:
<div class="outer1">
  <!-- two DIVs: .inner1, .inner2 -->
</div>
<div class="outer2">
  <!-- two DIVs: .inner2, .inner2 -->
</div>
<div class="outer3">
  <!-- two DIVs: .inner3, .inner3 -->
</div>
2013-08-09 22:45:42 -05:00
mattn
9791571ff4 Remove default html indentation 2013-08-09 13:06:48 +09:00
DeaR
b9bd4738dc Fix duplicate key. 2013-08-08 18:04:25 +09:00
mattn
6d924eb310 Remove div element for snippets 2013-08-08 12:31:51 +09:00
mattn
e1fecdc77b version bump up 2013-08-08 12:31:46 +09:00
mattn
db7c3bebc8 Merge pull request #135 from joedicastro/master
Fixes #133
2013-08-07 18:32:10 -07:00
joe di castro
7fb711c257 Fixes #133 2013-08-07 18:57:19 +02:00
mattn
455f6f5760 Fixes #131 #134 2013-08-08 00:47:56 +09:00
mattn
fd7c37d618 rename 2013-08-06 20:00:30 +09:00
mattn
43d5656dca Rename to Emmet.vim! 2013-08-06 19:49:59 +09:00
mattn
5d54856b49 Keep 0, no adding px unit when expanding b0 2013-06-28 09:55:15 +09:00
mattn
0b37e09e5e Fix typo 2013-06-17 16:32:05 +09:00
mattn
53e8b80dfd Fixes links to blogs. Closes #125 2013-06-14 15:12:53 +09:00
mattn
32bb75081c Add doc for lorem+ipsum 2013-06-10 21:18:18 +09:00
mattn
a98478d7dc Add test for #124 2013-06-10 21:08:14 +09:00
mattn
e7460ef2ec Should be all ${cursor} in the tokens for m0+bgi+p0. The value is not decided with token, value should be empty. 2013-06-10 21:01:53 +09:00
mattn
daaa9450a6 bg++bg+ 2013-06-10 20:42:00 +09:00
mattn
4221cd94ed Version guard 2013-06-10 20:24:29 +09:00
mattn
8cc33aedf4 Add tests for sass 2013-06-10 19:37:17 +09:00
mattn
32c9eaf0c6 Don't use workaround. remove last ; correctly. Fixes #124 2013-06-10 19:36:17 +09:00
mattn
917a9d4bb3 Should be non-space in default 2013-06-10 19:35:27 +09:00
mattn
ae7d014738 Add last comma 2013-06-10 19:34:36 +09:00
mattn
6619d5078e lorem for japanese 2013-06-06 18:24:15 +09:00
mattn
8e515a11c2 Add custom_expand 2013-06-06 17:32:10 +09:00
mattn
30d304ff1f Add user-defined dollar expression (Merged tang3w's awesome commits) 2013-06-06 12:17:42 +09:00
mattn
ca95069268 Fix typo 2013-06-03 22:29:26 +09:00
mattn
857ecdb813 Fix typo 2013-06-03 22:27:41 +09:00
mattn
aabea8343f Oops 2013-06-03 12:13:25 +09:00
mattn
64b64e6bf8 Lorem Ipsum 2013-06-03 12:06:12 +09:00
mattn
dd16ce3b0b Merge pull request #123 from shlomif/master
Grammar corrections.
2013-05-15 17:00:13 -07:00
Shlomi Fish
1d6a0917dc Correct grammar in the tutorial. 2013-05-15 19:03:50 +03:00
mattn
6dfd49a31f Merge pull request #122 from shlomif/master
Remove trailing space + Grammar Corrections.
2013-05-15 06:30:54 -07:00
Shlomi Fish
f128d1013b [README] Correct some grammar problems. 2013-05-15 16:25:19 +03:00
Shlomi Fish
3b8f3ac778 Remove trailing space. 2013-05-15 16:18:25 +03:00
mattn
b162859ca8 Fix indentation 2013-05-08 10:17:22 +09:00
mattn
62c6622153 Fix attributes missing 2013-05-08 10:17:12 +09:00
mattn
4757aae967 Use meta charset. This may occur some problem. For example charset=Windows-31J won't work correctly. 2013-05-08 09:28:33 +09:00
mattn
6a68c46d88 Fix lost attributes. Close #121 2013-05-08 09:27:37 +09:00
mattn
8499af4c47 Fixed typo 2013-04-24 21:30:35 +09:00
mattn
03c6771311 Merge pull request #120 from crazymaster/master
Fixed typo.
2013-04-24 05:24:58 -07:00
crazymaster
dad1eb19c3 Fixed typo. 2013-04-24 21:20:33 +09:00
mattn
9239eed295 Add test for #98 2013-04-24 20:44:06 +09:00
mattn
6fd2031fa2 Fixed #98 pass to indent to html#toString() 2013-04-24 20:43:15 +09:00
mattn
7c1f881014 Remove blank line 2013-04-23 09:49:52 +09:00
mattn
fb7829ca4b Add test for #118 2013-04-23 09:49:03 +09:00
mattn
bc262ed52b Use group_itemno or itemno that greating. close #118 2013-04-23 09:46:04 +09:00
mattn
25aeb9d1c3 Add test 2013-04-19 13:24:05 +09:00
mattn
1f041e7dd3 Unique attribute names. close #119 2013-04-19 13:22:06 +09:00
mattn
6d07bd9752 Separate rendering type and filetype 2013-04-09 19:18:41 +09:00
mattn
857809e676 Fix guessing filetype 2013-04-09 18:55:21 +09:00
mattn
2aba8dde8b Fix balance tag. close #107 2013-04-09 18:45:18 +09:00
mattn
286788ae88 Add tests 2013-04-09 18:19:03 +09:00
mattn
dc199ba273 Fix $# expands 2013-04-09 18:14:39 +09:00
mattn
f5bb76ba39 Expands $# as content. close #116 2013-04-09 18:05:28 +09:00
mattn
4825e6b6c9 Fix order of attributes. close #117 2013-04-09 10:39:31 +09:00
mattn
f08061ec20 Fix imageSize 2013-04-06 22:58:20 +09:00
mattn
bc5903d69c Fix attrs_order 2013-04-06 22:41:08 +09:00
mattn
f1daca4fa5 Fix parse image size 2013-04-06 22:40:19 +09:00
mattn
7f674cd356 Fix tests 2013-04-06 22:33:23 +09:00
mattn
f86c34fbe8 Fix parseTag 2013-04-06 22:31:53 +09:00
mattn
39a9986627 Fix toggleComment 2013-04-06 22:16:23 +09:00
mattn
c0e0451489 Fix tests 2013-04-06 22:00:46 +09:00
mattn
77e2bd3c4e Add default attributes 2013-04-06 22:00:38 +09:00
mattn
62f0a02346 ditto 2013-04-06 21:44:27 +09:00
mattn
f99392847f Fix checking attributs 2013-04-06 21:41:23 +09:00
mattn
24eaace730 Avoid to duplicate attributes 2013-04-06 21:39:53 +09:00
mattn
7aecdc809d Merge pull request #114 from mgrubb/keep-attribute-order
Keep defined order of HTML attributes
2013-04-06 05:37:49 -07:00
Michael Grubb
594ca8e767 Added list to keep order of added attributes
Preloads this list with 'id' and 'class' to always sort those first
As attributes are parsed, append the names to the list.
Change toString function to loop over attribute list instead of keys.
2013-04-06 00:04:37 -05:00
mattn
6a84397073 Merge pull request #113 from avinash/master
The zencoding folder also needs to be copied to ~/.vim/autoload
2013-03-27 02:13:09 -07:00
Avinash Meetoo
e5ff2df906 The zencoding folder also needs to be copied to ~/.vim/autoload 2013-03-27 13:08:34 +04:00
mattn
59c2fb6647 Check bundled type at the first 2013-03-26 12:48:02 +09:00
mattn
82c09728d7 Fix checking type for expanding abbreviation. Also move types htmldjango/drupal into default settings. 2013-03-26 12:43:43 +09:00
mattn
0e4fe62138 Merge pull request #106 from Poltergeist/master
Added less support
2013-02-19 17:47:40 -08:00
Philipp Hinrichsen
73386514ea added less support 2013-02-18 13:20:19 +01:00
mattn
dc65299159 add zencoding_use_identify to disable. default is 1. 2013-02-13 09:02:43 +09:00
mattn
77c863af95 Merge pull request #104 from dpino/fast-image-size
Use command 'identify' (if supported) to get the size of a local image
2013-02-12 15:52:50 -08:00
Diego Pino
760d00cb89 Use function 'executable' to check if command 'identify' is available 2013-02-08 22:38:11 +01:00
Diego Pino
c088101cb7 Use command 'identify' to retrieve the size of a local image
* Command 'identify' is provived by ImageMagick
2013-02-07 18:32:59 +01:00
mattn
8c072f6a3b fix typo. 2013-01-22 14:14:28 +09:00
mattn
7aee52d710 Merge pull request #101 from snowmantw/patch-1
Update doc/zencoding.txt
2013-01-21 20:46:20 -08:00
mattn
8734406ab6 Merge pull request #100 from snowmantw/master
Optional ZenCoding functions in different modes.
2013-01-21 20:46:03 -08:00
Greg Weng
0d4bc41f03 Update doc/zencoding.txt 2013-01-22 12:42:41 +08:00
Greg Weng
8862640291 Update README.mkd 2013-01-22 11:23:25 +08:00
Greg Weng
97b753223e Update README.mkd 2013-01-22 11:22:53 +08:00
Greg Weng
2d3a46238b Optional zencoding functions in different modes. 2013-01-22 11:18:44 +08:00
Greg Weng
ab1be77b86 Update README.mkd 2013-01-22 11:15:29 +08:00
mattn
27350c3672 fix guessing utf-8 2013-01-11 09:51:32 +09:00
mattn
8c108ad27d use lower case 'html' for <DOCTYPE HTML> 2013-01-07 12:07:05 +09:00
mattn
f6c5a8c717 fix balance inward. 2012-12-04 10:51:32 +09:00
mattn
ac43ff8cd9 remove semi-colon in sass. 2012-11-06 20:22:47 +09:00
mattn
70fe3aa22c version bump up. 2012-11-02 12:24:22 +09:00
mattn
9b3643796a fix. 2012-11-02 12:14:38 +09:00
mattn
40107b67c4 gh-pages. 2012-11-02 12:09:51 +09:00
mattn
77855c4fe1 add snippets for sass. 2012-10-24 11:27:34 +09:00
mattn
f0ba3ef4a5 fix fc filter. 2012-10-24 11:22:55 +09:00
mattn
eed6b2db44 fix fc filter. 2012-10-24 11:21:17 +09:00
mattn
7a25848537 add tests. 2012-10-24 11:13:43 +09:00
mattn
672af42b71 support (bg+)+c like format. 2012-10-24 11:13:34 +09:00
mattn
95455cc4c8 move cursor to eol if value was set. 2012-10-24 10:34:30 +09:00
mattn
34ce1afda0 add tests. 2012-10-24 10:29:20 +09:00
mattn
9c02c521f1 fix: em/p units. remove debug message. 2012-10-24 10:29:07 +09:00
mattn
bd8296d27c support m10-5 like format. 2012-10-24 10:20:25 +09:00
mattn
df2b758819 fix test. 2012-10-16 22:41:14 +09:00
mattn
6b8e9720cf fix. 2012-10-16 22:40:21 +09:00
mattn
e5baec0d46 Disable completion of unit for z(z-index). This workaround should be removed. 2012-10-16 17:37:38 +09:00
mattn
551740c720 add note. 2012-10-16 17:15:50 +09:00
mattn
3d7138f3ae add tests. 2012-10-16 17:14:31 +09:00
mattn
272bad5c53 treat WORD. 2012-10-16 17:14:26 +09:00
mattn
6575f65eaf support linear gradient. 2012-10-16 17:07:47 +09:00
mattn
e4bbc7fcd4 add test. 2012-10-16 16:21:02 +09:00
mattn
cc7a2ecf38 support ^ 2012-10-16 16:19:28 +09:00
Charles McGarvey
68f6e1851a add option for customizing the empty tag suffix
Example: To expand the br tag as <br/> instead of the default <br />, put this
in your .vimrc:

let g:user_zen_settings = {
\  'html': {
\    'empty_element_suffix': '/>',
\  },
\}
2012-09-01 13:09:50 -06:00
Charles McGarvey
e7af8d0793 make snippet expanding obey user tab settings 2012-09-01 13:03:59 -06:00
mattn
72e10f85fe fix cursor placing for haml & slim. close #92 2012-08-23 11:39:28 +09:00
mattn
b45b08f5e8 fix jpeg decoder. 2012-08-02 11:47:25 +09:00
mattn
b731410946 fix indent. 2012-07-27 09:13:34 +09:00
mattn
f60a983ae9 retab. 2012-07-26 14:35:42 +09:00
mattn
5c3abc98a2 fix indent: when wrap inner text with block element, it don't append indent. close #90 2012-07-26 14:16:35 +09:00
mattn
7ad7c1032e escape indent character if it's like '\t' (not "\t"). however, it won't beuseful for me. 2012-07-26 08:58:08 +09:00
mattn
2393c3772a escape filter to be possible to specify regexp. 2012-07-23 20:54:47 +09:00
mattn
2ad5bddc8c filter to split to separated columns with wrap-with-abbreviation. 2012-07-23 20:48:49 +09:00
mattn
267b428943 add test. 2012-07-17 16:19:57 +09:00
mattn
7f38e6f78e version bump up. 2012-07-17 15:30:59 +09:00
mattn
2e3769f5d8 version bump up. 2012-07-17 15:30:44 +09:00
mattn
b46410cf05 fixed back to parent nest. close #88 2012-07-17 15:29:51 +09:00
mattn
d5a3582b6a behave wrap with abbr if dollar_expr is set. 2012-07-06 16:28:06 +09:00
mattn
8209775129 add new option dollar_expr that don't replace $ to numbers. 2012-07-06 13:39:08 +09:00
mattn
14ba403bf2 fixed bug that '#' was appended with input:text in haml. 2012-07-03 10:36:09 +09:00
mattn
5244c6ec5e fix test. 2012-07-02 13:14:23 +09:00
mattn
490802965d fix escape filter. close #85 2012-07-02 10:03:43 +09:00
mattn
689ff1efab fix test. 2012-06-29 09:57:27 +09:00
mattn
855e1a73df add lang.vim 2012-06-29 09:56:15 +09:00
mattn
255902037d cache result of file types checking. 2012-06-29 09:54:58 +09:00
mattn
61a261ef89 check empty. 2012-06-29 09:19:46 +09:00
mattn
e1e79f3d25 fix indent. 2012-06-28 22:10:44 +09:00
mattn
c55e379172 fix analyzing jpeg image size. 2012-06-28 22:10:27 +09:00
mattn
8194ee6683 rewrite html#balanceTag. 2012-06-22 14:47:12 +09:00
mattn
43a9e6f962 fix inline_elements/block_elements. 2012-06-20 12:42:01 +09:00
mattn
c1ce62261f fix indent for wrapped text. 2012-06-20 12:41:40 +09:00
mattn
57754d9506 open folding. close #83 2012-06-20 11:43:58 +09:00
mattn
264df14c43 treat as scss. 2012-06-13 22:11:17 +09:00
mattn
8d10026f61 orz 2012-06-13 22:07:55 +09:00
mattn
aedd9026f0 hahaha 2012-06-13 22:07:18 +09:00
mattn
403058a97d remove last ; 2012-06-13 22:06:45 +09:00
mattn
79c60d1cf5 add sass support. (really?) 2012-06-13 22:04:57 +09:00
mattn
09b6efb86b ; needed. 2012-06-13 22:00:41 +09:00
mattn
af0e4f1166 s/sass/scss/g 2012-06-13 21:58:57 +09:00
mattn
ca4675c02f add sass support. 2012-06-13 21:45:58 +09:00
mattn
24e65cd412 default filetype. 2012-06-13 21:45:38 +09:00
mattn
bddc3f9ff5 check encoding more smart. 2012-06-13 18:44:45 +09:00
mattn
05688356b3 fix indent for ${child}. 2012-06-13 18:21:30 +09:00
mattn
16e3a95d7f fixed ${nr}. and fixed multi-line text for haml & slim. 2012-06-13 18:02:23 +09:00
mattn
65c8fe1d23 missing } 2012-06-13 17:36:52 +09:00
mattn
e5b1e29964 fix indent for multiplier items. 2012-06-13 17:20:36 +09:00
mattn
968afb8cbd fix numbering. 2012-06-12 18:01:19 +09:00
mattn
758f96e171 fix numbering. 2012-06-12 18:00:44 +09:00
mattn
b61feb2f76 why call in several time. 2012-06-11 20:02:12 +09:00
mattn
1ddb427987 fix detecting eol. 2012-06-11 19:24:55 +09:00
mattn
d19b2b4fcd fix snippets for haml & slim. 2012-06-11 19:15:45 +09:00
mattn
5011ea1dc6 fix numbering. 2012-06-11 18:21:05 +09:00
mattn
edbf970d03 add test. 2012-06-11 17:58:44 +09:00
mattn
3fc634d532 add test. 2012-06-11 17:57:11 +09:00
mattn
c85ae9df08 add tests. 2012-06-11 17:54:24 +09:00
mattn
ba8571bad6 fix test. 2012-06-11 17:51:39 +09:00
mattn
15c3f99c68 fix: {item number $ ${nl}}*5 2012-06-11 17:41:41 +09:00
mattn
fc604fc4b0 add test. 2012-06-11 11:34:38 +09:00
mattn
dcccfc6881 fix group item number. close #25 2012-06-11 11:32:59 +09:00
mattn
c35a379b27 add tests. 2012-06-11 10:14:38 +09:00
mattn
8551b28a74 fix indent. close #27 2012-06-11 10:05:41 +09:00
mattn
4c56e1146e fix tests. 2012-06-11 09:12:07 +09:00
mattn
b696d02b68 version bump up. 2012-06-10 02:25:27 +09:00
mattn
915726a88d fix indent for wrap with abbreviation. 2012-06-10 02:11:16 +09:00
mattn
01b6732fd6 no need to add cursor when has children. 2012-06-10 02:02:56 +09:00
mattn
b75f89ab57 add cursor position. 2012-06-10 01:57:34 +09:00
mattn
b62af86318 fix tests. 2012-06-10 01:55:28 +09:00
mattn
d5145397cb new style formatter. 2012-06-10 01:55:16 +09:00
mattn
19f984b165 update doc. 2012-06-07 12:55:48 +09:00
mattn
faaaed9840 new feature, add code pretty. 2012-06-07 12:50:07 +09:00
mattn
d71acb2c22 fix comment filter. 2012-06-07 11:54:37 +09:00
mattn
f5c6ad10dc bits fix unittest. 2012-06-06 20:43:35 +09:00
mattn
c4494a24f6 colorfull! 2012-06-06 13:05:29 +09:00
mattn
1a9b7d2805 check top level node or not. close #80 2012-06-06 12:09:49 +09:00
mattn
19db2eebe5 reload after workarounds. 2012-06-06 12:08:10 +09:00
mattn
f6f4749be9 modify test suite. 2012-06-05 15:59:02 +09:00
mattn
07d9400fbb move tests into here documents. 2012-06-05 15:29:00 +09:00
mattn
70e54ff88e modify test suite. 2012-06-05 15:17:54 +09:00
mattn
73e599e294 oops... 2012-06-05 14:47:57 +09:00
mattn
0f57b90bf9 fix haml splitJoinTag. 2012-06-05 10:42:27 +09:00
mattn
c53d5a2971 add test for splitJoinTag for haml & slim. 2012-06-05 10:42:16 +09:00
mattn
843e99c883 fix behavour to toggle. 2012-06-05 01:15:02 +09:00
mattn
b8ba003728 don't move down. 2012-06-05 01:14:51 +09:00
mattn
10687b23ac done. 2012-06-04 22:59:06 +09:00
mattn
9835978968 splitJoinTag for haml & slim. 2012-06-04 22:58:01 +09:00
mattn
85b6ed4349 add some tests. 2012-06-04 18:10:31 +09:00
mattn
2139620edf add some tests. 2012-06-04 18:03:15 +09:00
mattn
7967655b9c add indent spaces. 2012-06-04 17:22:13 +09:00
mattn
4dfd07003e removeTag for haml & slim. 2012-06-04 17:12:31 +09:00
mattn
d3f4db7367 calculate 'indentation' from shiftwidth. close #78 2012-06-04 16:37:45 +09:00
mattn
3d3ae065eb add :Zen command. 2012-06-03 01:21:25 +09:00
mattn
1efd8a094f move splitJoinTag into each types. 2012-06-03 00:39:05 +09:00
mattn
11af392af3 avoid to move to </a>|</span>. 2012-06-03 00:31:17 +09:00
mattn
2ff5526a0c check text node or not. 2012-06-03 00:14:42 +09:00
mattn
7b0c846018 fix re-set parent of brother node. all tests are passed again! 2012-06-02 23:06:28 +09:00
mattn
80fda7de36 some tests are possible to pass. 2012-06-02 09:26:27 +09:00
mattn
4c33c082c8 start to fix formatting. 2012-06-01 18:58:13 +09:00
mattn
ddf38f4e99 make anchor. 2012-06-01 13:31:47 +09:00
mattn
75d229b320 balanceTag for haml & slim. 2012-06-01 11:59:53 +09:00
mattn
e80ce9a642 fix tests. 2012-06-01 03:47:25 +09:00
mattn
b846bc72b8 ah, I've done it already. 2012-05-31 22:07:44 +09:00
mattn
a7e6a7ae03 update TODO. 2012-05-31 22:07:31 +09:00
mattn
99585c507c anchorizeURL. 2012-05-31 22:07:05 +09:00
mattn
ace1bc521a fix attribute quote. 2012-05-31 22:04:32 +09:00
mattn
d484c131b9 oops. 2012-05-31 19:26:40 +09:00
mattn
04b34844f1 add function to get snippets candidates for completion. thanks: https://gist.github.com/469369 2012-05-31 19:25:21 +09:00
mattn
c3785c4a1a update docs. 2012-05-31 19:20:49 +09:00
mattn
9760bc0959 add TODO 2012-05-31 18:18:13 +09:00
mattn
7fe889d214 moveNextPrev 2012-05-31 17:47:14 +09:00
mattn
06dd83dad3 fix toggleComment. 2012-05-30 22:08:07 +09:00
mattn
dd44d64d56 check region. 2012-05-30 22:04:46 +09:00
mattn
b689b7a6e5 balanceTag. 2012-05-30 22:01:32 +09:00
mattn
c2cf315a05 fix toggleComment for css. 2012-05-30 21:36:59 +09:00
mattn
15a655a415 toggleComment for haml. 2012-05-30 21:15:41 +09:00
mattn
a1731c718d toggleComment for slim 2012-05-30 21:12:34 +09:00
mattn
0330ce39b4 toggleComment. 2012-05-30 21:00:59 +09:00
mattn
e3f72a588a camelcase. 2012-05-30 20:40:20 +09:00
mattn
9295915002 fix test. 2012-05-30 20:28:04 +09:00
mattn
87def4ce94 imageSize for haml. 2012-05-30 20:24:40 +09:00
mattn
ae2d88eed8 imageSize for slim 2012-05-30 20:17:19 +09:00
mattn
6751400cce remove debug log. 2012-05-30 19:53:28 +09:00
mattn
57e43e4833 fix skipping tags. 2012-05-30 19:22:26 +09:00
mattn
14fb367409 move utils. 2012-05-30 19:16:31 +09:00
mattn
c8ec156876 find autoload/zencoding/lang/xxx.vim 2012-05-30 19:07:53 +09:00
mattn
98f716c4d1 mv zencoding/xxx.vim to zencoding/lang/xxx.vim 2012-05-30 19:02:10 +09:00
mattn
b18d8ce9ab fix finding tokens. 2012-05-30 09:05:46 +09:00
mattn
24a0418274 oops. 2012-05-29 08:51:07 +09:00
mattn
1b42bbd78e version bump up. 2012-05-29 08:50:07 +09:00
mattn
8ec50c24f5 add test. 2012-05-29 08:49:13 +09:00
mattn
0d2026b1f1 update date. 2012-05-29 08:49:04 +09:00
mattn
0a4e2db3cc fix finding tokens. 2012-05-29 08:45:31 +09:00
mattn
f4d804dbaf version bump up. 2012-05-28 17:25:02 +09:00
mattn
17724b9522 fix begining of tokens. 2012-05-28 17:24:00 +09:00
mattn
7b6341f88b modify doc. 2012-05-28 10:23:57 +09:00
mattn
316923ecbe modify doc. 2012-05-28 10:23:38 +09:00
mattn
b0732a00d0 version bump up. 2012-05-28 10:21:58 +09:00
mattn
08666e545d fix findtoken. it occur maxmempattern error. 2012-05-28 09:23:16 +09:00
mattn
33b90dcaf1 interactive tests. 2012-05-23 18:52:32 +09:00
mattn
af3a1acf40 add tests. 2012-05-23 18:34:30 +09:00
mattn
c3ffd8727e guard to endless loop. 2012-05-23 17:34:22 +09:00
mattn
cf8c5b35f7 fix lhs in partial coding. 2012-05-23 17:31:32 +09:00
mattn
aea4becc0e find begining of tokens. 2012-05-23 14:44:12 +09:00
mattn
b13fc41a35 rename functions. 2012-05-23 14:22:17 +09:00
mattn
1b937875b4 support slim. 2012-05-23 14:10:24 +09:00
mattn
72d344174f call dynamicaly. 2012-05-23 12:37:35 +09:00
mattn
d40f63c724 separate files. 2012-05-23 11:47:02 +09:00
mattn
918be7d824 add tests related #18 2012-05-21 18:23:31 +09:00
mattn
13672245b3 remove needless 'a' in balance word. 2012-05-21 17:45:10 +09:00
mattn
9c042e6907 change behaviour. now zencoding-vim expand abbreviation from LAST-WORD. close #18 2012-05-21 17:45:04 +09:00
mattn
e1015e8470 add test. 2012-05-07 16:54:34 +09:00
mattn
4a0e7d1fb2 fix $# contains &. 2012-05-07 16:27:35 +09:00
mattn
104a4b5ac0 fixed character wise selection. 2012-05-07 11:17:35 +09:00
mattn
13f4b677c9 keep whitespace on selection 'v'. related #69 2012-05-06 00:53:05 +09:00
mattn
ad19b79b65 version bump up. 2012-05-02 12:32:01 +09:00
mattn
f1bb86e57e fix wrap with p{ {{ main }} }. close #66 2012-05-02 11:28:29 +09:00
mattn
7453ca403c fixed related issue about wrap with a{{foo}} in #66 2012-05-01 10:07:44 +09:00
mattn
540480bd6b fix related issue #66 2012-04-28 22:23:10 +09:00
mattn
0eddf94b6f refactor test suite. 2012-04-26 01:09:55 +09:00
mattn
bdf8c3ffe1 remove debug message. 2012-04-24 20:54:04 +09:00
mattn
cb7cb86184 replace $# to content in the rest. 2012-04-24 11:41:47 +09:00
mattn
52fbf6d33e prior filetype to inline attribute. 2012-04-24 11:12:35 +09:00
mattn
3e679f8a9a fix issue of text nodes. close #64 2012-04-24 10:43:24 +09:00
mattn
1883fecec0 add test case related #65 2012-04-23 15:26:59 +09:00
mattn
8126a94272 fix abbr expandos. related #65 2012-04-23 15:26:44 +09:00
mattn
f66501ccd1 fix expandos. close #65 2012-04-23 15:06:37 +09:00
mattn
c492fc64f0 don't need conversion. 2012-03-28 18:26:56 +09:00
mattn
01524e272f useragent. 2012-02-21 15:34:58 +09:00
mattn
5efe248f0e fix {} regexp pattern. close issue #58 2012-02-14 19:45:28 +09:00
mattn
3766ec94ea version bump up. 2012-01-31 13:47:47 +09:00
mattn
4d295a516b fixed issue #56. 2012-01-31 13:46:24 +09:00
mattn
e6e89137e2 fix toggleComment. close #55 2012-01-26 10:25:57 +09:00
mattn
62c8a5c39e typo in doc. 2012-01-17 10:28:23 +09:00
mattn
d4c971b7c4 merge lines. close issue #52 2012-01-17 10:24:44 +09:00
mattn
61ca294004 more strictly. 2012-01-11 13:46:57 +09:00
mattn
d7e4896a28 fix imageSize. close issue #53 2012-01-10 17:35:42 +09:00
mattn
6eff2a965f oops. fixed trim filter. 2011-12-16 09:36:06 +09:00
mattn
c9398065c8 added trim filter. 2011-12-16 09:35:08 +09:00
mattn
a386d41384 fix wrap 2011-12-15 02:58:50 +09:00
mattn
65588192a4 Merge branch 'master' of github.com:mattn/zencoding-vim 2011-12-15 02:30:10 +09:00
mattn
732a8aa1d1 fix parser to match class like ".b-block__subitem". close #50 2011-12-07 09:12:31 +09:00
mattn
1f4dbe3917 check normal mode or not. 2011-12-05 14:50:47 +09:00
mattn
513578327c fix cursor position. 2011-12-05 12:40:38 +09:00
mattn
0e104e30f5 visual line. 2011-12-01 11:51:48 +09:00
mattn
1bb674d731 fixed join tag for xsl. close #48 2011-11-30 09:11:14 +09:00
mattn
3dac32d31c I perfer the name. 2011-11-27 19:23:59 +09:00
mattn
475d1b0a6f Merge pull request #47 from fersho311/master
Started a readme File
2011-11-27 02:16:19 -08:00
Song Zheng
aca236d40d almost complete readme 2011-11-25 22:07:28 -08:00
Song Zheng
304fb93d16 new formatting 2011-11-25 21:10:46 -08:00
Song Zheng
66b00b5e40 fixed a little format 2011-11-25 21:08:56 -08:00
Song Zheng
6f7d59c030 added readme file 2011-11-25 21:04:00 -08:00
mattn
16a09f81c1 attribute index like node[attr$] 2011-11-25 22:28:45 +09:00
mattn
74331b5545 remove sass. include behavior of css. added !important; 2011-11-25 19:36:42 +09:00
mattn
f7047e7520 don't do 'gvc' when not visual mode. closes issue #46 2011-11-25 18:19:27 +09:00
mattn
afabf9d4a0 erase selected lines. 2011-11-24 20:58:46 +09:00
mattn
c1ea1e576b avoid to expand '<>' in css. 2011-11-24 16:06:36 +09:00
mattn
e7b6ce30f1 add option 'use_pipe_for_cursor'. fixes issue #38 2011-11-24 15:51:24 +09:00
mattn
4b4aef917b fix bug that break multibyte characters when using wize selection. 2011-11-24 15:28:14 +09:00
mattn
e123792281 oops. fixed normal {foo}. 2011-11-24 15:09:06 +09:00
mattn
ba5c040894 support of blockwize selection. 2011-11-24 15:07:03 +09:00
mattn
e16879217d wrap normaly in last tag when don't contain "*" for wrap abbreviation. 2011-11-24 14:27:16 +09:00
mattn
32aacd57ab set config back at last. 2011-11-24 14:26:58 +09:00
mattn
b05a4e281f fixed conversion of tag name like h${sometext}*3. 2011-11-24 12:35:43 +09:00
mattn
ec071d3b63 fix toggle comment. 2011-11-24 11:55:28 +09:00
mattn
896520d48e version bump up. 2011-11-22 21:38:46 +09:00
mattn
6b65455e94 oops. fixed foo+ style expandos. 2011-11-22 21:38:01 +09:00
mattn
6521d273fb version bump up. 2011-11-22 19:09:07 +09:00
mattn
ac6d7fb269 remove debug message. 2011-11-22 19:08:03 +09:00
mattn
0072354226 fix expandos. 2011-11-22 19:07:21 +09:00
mattn
99b6e2d292 fix separator for css. 2011-11-21 15:16:47 +09:00
mattn
115f68df62 version bump up. 2011-11-08 11:11:06 +09:00
mattn
accc9934d2 fixed contents parser. 2011-11-08 11:09:54 +09:00
mattn
7bed58f537 typo in TUTORIAL. fixed #39 2011-11-02 15:58:07 +09:00
rabidpraxis
3ce2d835be added sass compatibilty 2011-10-26 21:21:44 +09:00
mattn
47a4d1ffa3 fix analyzing content summary. 2011-10-26 21:21:14 +09:00
mattn
8f8cd747b2 Merge branch 'master' of github.com:mattn/zencoding-vim 2011-10-25 13:50:57 +09:00
mattn
b0b2323d3a update. 2011-10-25 13:50:43 +09:00
mattn
773f87b62b version bump up. 2011-10-22 23:54:41 +09:00
mattn
eaa447fb40 support: Upgraded "Wrap With Abbreviation" action 2011-10-14 21:35:38 +09:00
mattn
f8f9dcd72e replace $# as line for wrap abbreviation. 2011-10-14 18:58:12 +09:00
mattn
450768be48 fix incomplete string. 2011-10-12 11:13:58 +09:00
mattn
54924cb5d5 g:zencoding_curl_command 2011-09-26 13:30:57 +09:00
mattn
f34dd90f73 oops. 2011-09-22 20:41:54 +09:00
mattn
44619b2584 oops. :set ff=unix 2011-09-22 17:18:30 +09:00
mattn
775dfb99e2 oops. version mismatch. 2011-09-22 15:37:25 +09:00
mattn
d9957b0baf version bump up. 2011-09-22 15:31:36 +09:00
Hugues Lismonde
c5db7c80d2 SASS support 2011-09-22 15:20:18 +09:00
mattn
f844ab85b0 unitetest for xsd. 2011-09-22 15:16:21 +09:00
Toshiyuki Ogura
43f36d6069 fix typo 2011-09-22 15:13:00 +09:00
Toshiyuki Ogura
8d6256e1f8 add xsd 2011-09-22 15:12:48 +09:00
Jesse Luehrs
8f290b913e oops, fix the regex (clear out everything before matched tags) 2011-09-22 15:11:44 +09:00
Jesse Luehrs
25ecc2ca99 don't screw up expansion if there's already an existing tag (#23)
<p>a>b_</p>

now expands to

<p><a><b>_</b></a></p>

rather than

<p>
  <a><b></b></a>
</p></p>
2011-09-22 15:08:10 +09:00
mattn
95df77c224 fix unittest.vim 2011-09-05 01:06:19 +09:00
mattn
e799b8ead5 Merge pull request #33 from fiskus/master
border radius
2011-08-18 17:01:26 -07:00
Maxim Chervonny
d67f118b13 border-radius rules brought to conformity with official ZenCodingWiki 2011-08-18 18:26:04 +04:00
mattn
88d89910e2 Merge pull request #30 from serverhorror/fix-submodule-usage
fix submodule usage
2011-05-08 07:10:11 -07:00
Martin Marcher
6f584f3419 fix submodule usage
when using pathogen and git submodules this keeps git status from
complaining about untracked content
2011-05-07 20:51:41 +02:00
mattn
dcc75d8a19 Merge branch 'master' of github.com:mattn/zencoding-vim 2011-04-09 00:36:51 +09:00
mattn
7ccba3e1bb typo 2011-04-09 00:36:27 +09:00
mattn
4bbbe1d3de enable fc filter for css. fix issue #21 2011-02-24 19:04:00 +09:00
mattn
2091f33c82 django template 2011-02-23 15:44:33 +09:00
mattn
77e480c140 remove $line$ at the last. 2011-02-23 15:40:49 +09:00
mattn
aa7d54e0f0 fix haml test. 2011-02-23 15:25:13 +09:00
mattn
3ece783f74 gif size was swapped. 2011-01-25 09:20:42 +09:00
Andy Ferra
3ba6851c1a removed whitespace removal behvavior for empty tags 2011-01-19 11:58:42 -07:00
mattn
9a941aad9b fix broken wrap expanding. 2011-01-14 09:23:08 +09:00
mattn
8b8aa71043 version bump 2011-01-13 14:52:26 +09:00
mattn
e4dc78bc9b fixed wrap expanding with '&'. 2011-01-12 11:49:03 +09:00
mattn
cda02374cd add test for .content{Hello!} 2011-01-06 11:16:55 +09:00
mattn
96e256df37 expand .content to class="content" 2011-01-06 11:13:44 +09:00
mattn
1bbf5b06ad no more scroll 2011-01-06 11:06:54 +09:00
mattn
72ef007a84 add test for haml a*3 2011-01-06 10:51:25 +09:00
mattn
d9b9733bd0 fix issue #16 2011-01-06 10:48:32 +09:00
mattn
771343cf24 add test for bg+ 2011-01-06 10:37:24 +09:00
mattn
eefd49426f fix issue #17. 2011-01-06 10:36:39 +09:00
mattn
555aee4d3d version bump. 2010-11-22 21:15:45 +09:00
mattn
0dcce23ef0 fix parsing #{{foo}} and .{{bar}} 2010-11-22 21:14:06 +09:00
mattn
1e63393779 fixed parse #foo{bar} or .foo{bar} 2010-11-22 20:59:12 +09:00
mattn
19bfc84054 possible to specify charset. default value is UTF-8 . 2010-11-22 20:45:13 +09:00
mattn
fe99a324a9 fix staff. 2010-11-18 12:44:33 +09:00
mattn
010a744683 fix staff 2010-11-18 12:44:06 +09:00
mattn
b960a0d6ab version bump. 2010-11-18 12:43:33 +09:00
mattn
17dfb732a8 add doc. 2010-11-18 12:32:06 +09:00
mattn
a722f513e1 use omnifunc. 2010-11-18 12:24:21 +09:00
mattn
295bceb85a test marker 2010-11-16 19:31:14 +09:00
mattn
d4287a23d4 add tests. 2010-11-16 19:19:26 +09:00
mattn
fd46018e06 ignore to use abs(). 2010-11-10 01:28:14 +09:00
mattn
4cf35d61e0 add staff for release in Makefile. 2010-11-10 01:23:10 +09:00
mattn
6d455bfeae fix unit test. 2010-11-10 01:23:04 +09:00
mattn
cb13e4a07d version bump 2010-11-10 01:15:20 +09:00
mattn
aeb24b1922 install mapping to global. 2010-11-10 01:14:23 +09:00
mattn
e72254f40a oops... zip was empty... orz 2010-11-05 20:44:59 +09:00
mattn
e3a9428c1d version bump 2010-11-05 14:40:14 +09:00
mattn
af324f7db0 update doc 2010-11-05 14:36:04 +09:00
mattn
e6299244b7 gurd 2010-11-05 14:35:53 +09:00
mattn
ca38aaa673 fix unittest 2010-11-05 11:37:07 +09:00
mattn
6d8d5a6ee2 autoloading 2010-11-05 11:14:14 +09:00
mattn
8b98743ff0 move it to plugin folder. 2010-10-14 13:22:14 +09:00
mattn
97e438a40b ignore script tag. 2010-10-08 11:00:25 +09:00
mattn
6d0c90f7d0 remove warning. 2010-10-08 11:00:07 +09:00
mattn
5ed0a7e599 fixed issue #11 2010-10-08 10:40:34 +09:00
mattn
feb6b8ca14 fixed checking whether have mapping. 2010-09-06 09:06:13 +09:00
mattn
16e048aaf4 Merge commit '62ef855ef42e7c0fc9c0' into mustache 2010-08-25 15:53:54 +09:00
Adam Backstrom
51bcdaa181 HTML default_attribute form:upload, setting enctype for forms that get file uploads. 2010-08-06 08:59:38 -04:00
mattn
2d9d13e4bd fix... 2010-08-02 15:31:03 +09:00
mattn
c623a72a39 fixed toggle comment. 2010-08-02 15:11:44 +09:00
mattn
7ac94b6e64 fixed endless loop 2010-08-02 14:58:29 +09:00
mattn
742e115a41 fixed 'toggle comment' 2010-08-02 14:54:13 +09:00
Daniel Schauenberg
62ef855ef4 add support for mustache in tag class 2010-07-06 16:55:52 +02:00
Daniel Schauenberg
748e969191 add unittest for mustache in tag class 2010-07-06 16:55:52 +02:00
Daniel Schauenberg
e6bdb86c2f add mustache sections unit test 2010-07-06 16:55:52 +02:00
Daniel Schauenberg
f77a31b174 add mustache to zen_settings dict 2010-07-06 16:55:52 +02:00
Daniel Schauenberg
a639eee9d8 add support for mustache tags as id 2010-07-06 16:55:52 +02:00
Daniel Schauenberg
0ec7f16fde whitespace fix 2010-07-06 16:55:52 +02:00
mattn
be54da653a fixed wrap included "{}". closes #5. 2010-07-06 23:45:51 +09:00
mattn
4ff2179ee3 use ${lang} 2010-07-03 23:58:47 +09:00
mattn
d7b9436e67 fixed behavior for nested block. like "html:5>#page>(header#globalHeader>(hgroup>h1+h2)+(nav>ul>li*3>a)+(form>p.siteSearch>input+input[type=button]))+(#contents>(#main>(section>h2+p*5)+p.pagetop>a[href=#page])+(#sub>p+(nav>ul>li>a)))+(footer#globalFoooter>(ul>li>a)+(p.copyright>small))" 2010-06-11 11:37:57 +09:00
mattn
de6198ab35 fixed select/option indent. 2010-06-07 21:54:38 +09:00
mattn
22ddd21796 version bump. 2010-05-31 20:09:03 +09:00
mattn
5788d9eb52 use html as default filter. 2010-05-31 20:07:52 +09:00
mattn
85cc6b07a3 my style 2010-05-24 10:02:14 +09:00
mattn
346e5cd99d Merge commit '6bc305a910399423e5c9' 2010-05-24 10:00:08 +09:00
mattn
e3ec54fb21 Merge commit 'b7f309f729c71170313e' 2010-05-24 09:59:49 +09:00
mattn
53871006c1 d:ib should be 'display:inline-block'. 2010-05-21 11:07:16 +09:00
mattn
a75e00c0bf dynamic filter. then, you can customize the filters. 2010-05-21 11:06:14 +09:00
OHASHI Hideya
6bc305a910 support "zensnippet" snippet for non-HTML 2010-05-15 11:18:38 +09:00
OHASHI Hideya
b7f309f729 support ${attr} in snippets 2010-05-15 11:17:22 +09:00
mattn
11b5ffa598 add doc. 2010-05-13 20:13:48 +09:00
mattn
304e0e386b add normal mode of ZenCodingExpandWord. 2010-05-13 20:12:08 +09:00
mattn
157bad472e can't customize key assign of ZenCodingExpandWord. 2010-05-13 20:08:30 +09:00
mattn
afbcac04b4 add the pure vimscript code for 'get image size'. you can use it without perl interface just now. 2010-05-13 10:06:50 +09:00
mattn
f2cb7b112c fixed problem about 'selection' option. 2010-05-11 13:38:48 +09:00
mattn
93104ffff5 version bump 2010-05-10 09:44:42 +09:00
mattn
e649cd2ad8 use v7h"_s instead of v7hs: ignore regsiter. 2010-05-10 09:42:42 +09:00
mattn
b60a67d64e version bump 2010-05-06 19:44:16 +09:00
mattn
0d857c3959 Merge branch 'master' of http://github.com/jk3us/zencoding-vim 2010-05-06 09:12:05 +09:00
mattn
a50d3cfcdb see 4ba6dde573 2010-05-06 09:07:34 +09:00
Jay Knight
7aef89ccd4 Replace $cursor$ regardless of value of 'backspace' setting 2010-05-04 10:37:38 -05:00
mattn
0e3cce60ac use script scope variable. 2010-04-23 01:47:38 +09:00
mattn
3aa240f7b8 typo 2010-03-19 10:05:15 +09:00
mattn
6b8149e726 oops. fixed problem that filter does not work. version bump. 2010-03-17 17:50:09 +09:00
mattn
9f6c077cb8 oops. this call mistake of co-pi-pe in japanese. 2010-03-17 17:46:39 +09:00
mattn
ff77763c0a fixed indent for comment. 2010-03-17 16:49:34 +09:00
mattn
282a3a9958 version bump 2010-03-16 22:11:11 +09:00
mattn
d78b041fd0 stop at failing test. 2010-03-16 22:09:37 +09:00
mattn
66d173288c more test cases. 2010-03-16 22:05:13 +09:00
mattn
0c28ad1791 remove '|' when calling ZenExpand() 2010-03-16 22:04:49 +09:00
mattn
5fb57a28d3 fixed problem that link:css does not become 'link' in php. however it should not be removed in xsl/xml. 2010-03-16 18:37:43 +09:00
mattn
06130914c6 Drastic Changes: include extended resource. this make be possible that php can expand 'html:5'. 2010-03-16 18:18:54 +09:00
mattn
8c2a246bee css comment. 2010-03-16 16:47:21 +09:00
mattn
76b476eb45 enable convertion of '!' to '!important' 2010-03-16 15:50:58 +09:00
mattn
a2a8882f7a treat a[title=TITLE rel] as 'title="TITLE" rel=""'. 2010-03-16 15:35:01 +09:00
mattn
f78d448252 fix doc. 2010-03-15 20:37:45 +09:00
mattn
7f0e2a13d0 use default type for install to ~/.vim/plugin/zencoding.vim 2010-03-15 20:35:21 +09:00
mattn
8c958179a3 fix 'filters' 2010-03-15 20:25:13 +09:00
mattn
bdf2d62559 version++ 2010-03-15 17:27:36 +09:00
mattn
2de194d06c increment/decrement visual block. 2010-03-15 17:20:29 +09:00
mattn
c909e11879 break. 2010-03-15 13:34:42 +09:00
mattn
deeca32153 oops. 2010-03-15 13:33:27 +09:00
mattn
805d715be0 filter is array. 2010-03-15 13:30:47 +09:00
mattn
6571c87336 xsl filter. 2010-03-15 13:21:54 +09:00
mattn
ed3874f065 use user's settings for filter. 2010-03-15 13:00:07 +09:00
mattn
6c4a79e963 rollback: use html specification. 2010-03-15 12:40:35 +09:00
mattn
d9e7b4cf2a use own settings for empty_elements/block_elements/inline_elements. 2010-03-15 12:20:18 +09:00
mattn
8d047d302b Merge branch 'master' of github.com:mattn/zencoding-vim
Conflicts:
	zencoding.vim
2010-03-15 11:54:18 +09:00
mattn
8df0a44996 add test. 2010-03-15 11:52:04 +09:00
mattn
b92c1a37a9 change behavior of type & filters. 2010-03-15 11:44:36 +09:00
mattn
e212a6a696 version++ 2010-03-14 02:45:53 +09:00
mattn
a8ce3841d6 12px 2010-03-14 01:27:28 +09:00
mattn
21b5d07790 use original indent instead of s:zen_settings.indentation for start of the line. 2010-03-14 01:05:48 +09:00
mattn
7068617f92 is not v. it's c! 2010-03-14 00:56:57 +09:00
mattn
d6c82b3f2d fixed problem breaking multibyte when cursor is in a part of line. 2010-03-14 00:33:45 +09:00
mattn
5e1002b3aa Merge branch 'master' of git@github.com:mattn/zencoding-vim 2010-03-13 00:11:32 +09:00
mattn
7e33ea1a7e enable inline javascript. 2010-03-12 19:16:57 +09:00
mattn
1de3fbe918 version++ 2010-03-12 12:03:42 +09:00
mattn
d9976b5d56 fixed indent. 2010-03-12 12:01:27 +09:00
mattn
6712c04459 ins 2010-03-12 11:58:49 +09:00
mattn
c047dba32b add doc that 2 ways to enable zencoding.vim for other languages you using. 2010-03-12 09:48:20 +09:00
mattn
9a4412e816 accept extends type from zen_settings. 2010-03-12 09:42:45 +09:00
mattn
ad794a21f0 Merge branch 'master' of git@github.com:mattn/zencoding-vim 2010-03-11 23:29:18 +09:00
mattn
8eec4c219d version++ 2010-03-11 12:04:45 +09:00
mattn
9fab173af3 attribute may be blank. 2010-03-11 03:05:39 +09:00
mattn
65a64a6e8b fixed indentation and $$$ problem. 2010-03-11 02:44:41 +09:00
mattn
4ba6dde573 add docs submodule. 2010-03-11 02:36:30 +09:00
mattn
37166712b2 fix indent. multiple $$$ problem. 2010-03-11 02:36:15 +09:00
mattn
f7d32c0987 add test for multiple classes. 2010-03-11 02:35:48 +09:00
mattn
e77872ec0b oops: missing support multiple classes. 2010-03-11 01:50:40 +09:00
mattn
c6e7a3038f replace indent space or tab to defined indentation in snippets. 2010-03-10 02:10:51 +09:00
mattn
ca1e9c9b9c enable next/prev in normal mode. 2010-03-09 21:51:47 +09:00
mattn
a1cbb01c78 fixed haml filter to output inner value. 2010-03-09 21:42:23 +09:00
mattn
5c7a135bd4 oops. fixed key assign. 2010-03-09 14:11:00 +09:00
mattn
031a88c4c6 oops 2010-03-09 13:28:44 +09:00
mattn
7b26a71768 version++ 2010-03-09 13:26:35 +09:00
mattn
dbedf03e00 check strict. 2010-03-09 12:51:45 +09:00
mattn
783c6a10f6 fixed doc. 2010-03-09 12:46:19 +09:00
mattn
404609b08a changed leading key '<c-z>' to '<c-y>'. then you'll type '<c-y>,' for expanding abbreviation. 2010-03-09 12:44:02 +09:00
mattn
7d5b6609d3 fixed balance outwize. 2010-03-09 12:11:24 +09:00
mattn
df3eb4ecba remove debug code. 2010-03-09 11:55:35 +09:00
mattn
ac2d5dcd47 resign using recursively call 2010-03-09 11:53:39 +09:00
mattn
8376d08247 make absolute path. 2010-03-09 03:03:13 +09:00
mattn
d74c2928a1 no need to filter. 2010-03-09 02:48:16 +09:00
mattn
69970b1621 remove cursor mark. 2010-03-09 02:46:00 +09:00
mattn
46fd337636 remove cursor. 2010-03-09 02:44:35 +09:00
mattn
72503f954d use region util. 2010-03-09 02:25:50 +09:00
mattn
10457913ea fixed indent. 2010-03-09 02:07:31 +09:00
mattn
b9c63d08e1 enable haml filter. 2010-03-09 01:57:59 +09:00
mattn
af7aeca083 default filter is 'html'. 2010-03-09 01:49:50 +09:00
mattn
e22429aba9 fixed haml filter. 2010-03-09 01:31:14 +09:00
mattn
4c34110628 fixed indent 2010-03-09 00:09:37 +09:00
mattn
0e21c19f6f large change. changed cursor mark to '${cursor}'. 2010-03-08 22:45:53 +09:00
mattn
33d049492b multiline 2010-03-08 21:17:15 +09:00
mattn
7587bf534f add test for haml filter. 2010-03-08 21:16:21 +09:00
mattn
4a4885c7a8 support haml filter. 2010-03-08 21:16:12 +09:00
mattn
3b18a7fc77 fixed issue #1. 2010-03-08 19:43:05 +09:00
mattn
339be72156 typo. 2010-03-08 19:03:47 +09:00
mattn
605f3d8ce3 add doc. 2010-03-08 19:00:52 +09:00
mattn
0d96516ed3 fixed title. and trim strings. 2010-03-08 19:00:42 +09:00
mattn
2e5268f285 more useful anchorize. 2010-03-08 18:45:22 +09:00
mattn
b2dc5ba2d4 parse anchor. 2010-03-08 17:14:25 +09:00
mattn
5f4ed21dde detect type from syntax 2010-03-08 16:56:37 +09:00
mattn
91d0385785 fixed test tool. 2010-03-08 16:23:48 +09:00
mattn
55b93c7aaa support 'fc' filter. 2010-03-08 16:15:53 +09:00
mattn
0aa0356d30 fixed behavior of '*' in wrapping with abbreviation. closes #1 2010-03-08 16:00:46 +09:00
mattn
0f9662bc1b fixed filter that only '|e' 2010-03-08 15:50:07 +09:00
mattn
ada3c0e51a no bufname. 2010-03-08 15:17:13 +09:00
mattn
5a0b8d4e76 supported 'e' filter and 'c' filter. 2010-03-08 15:15:17 +09:00
mattn
249cc98320 inward/outward. 2010-03-08 13:45:49 +09:00
mattn
52d62129ab anchorize URL. 2010-03-08 13:44:28 +09:00
mattn
17e161ef32 restore cursor position. 2010-03-08 13:24:42 +09:00
mattn
92f604e1bd search recursively 2010-03-08 13:17:13 +09:00
mattn
5d143b1974 updated doc. 2010-03-08 12:36:12 +09:00
mattn
99460233b4 fixed balance tag. 2010-03-08 12:26:55 +09:00
mattn
4e26621542 fixed toooooooooooooooooooooooo many bugs! 2010-03-08 12:20:39 +09:00
mattn
b66dfbe365 enable on </foo>. 2010-03-08 11:55:20 +09:00
mattn
3d9fbfd049 hmm. chinese puzzle. 2010-03-08 11:41:49 +09:00
mattn
0baf7df3f3 fixed comment block. 2010-03-08 00:05:57 +09:00
mattn
55df3e1a06 oops 2010-03-06 02:10:16 +09:00
mattn
729634a1b4 fix several bugs. 2010-03-06 02:06:23 +09:00
mattn
ed98e0faa5 fix comment block. 2010-03-05 23:01:32 +09:00
mattn
cb0a48ea32 oops. 2010-03-05 22:44:44 +09:00
mattn
c540355f8e remove debug message. 2010-03-05 22:35:16 +09:00
mattn
818044551a tutor 2010-03-05 22:34:57 +09:00
mattn
f928b2182c remove tag. 2010-03-05 22:33:47 +09:00
mattn
c51e890194 split join tag. 2010-03-05 22:25:57 +09:00
mattn
8118f59eae fixed comment block. 2010-03-05 20:06:03 +09:00
mattn
895147684e include regionutil.vim 2010-03-05 18:58:49 +09:00
mattn
ccbf87b817 ${datetime} 2010-03-05 14:14:22 +09:00
mattn
192fc49720 remove broken code. 2010-03-04 21:11:01 +09:00
mattn
8a2c4f1628 oops. many GLOB(XXXXX) files. orz 2010-03-04 20:55:03 +09:00
mattn
208553fc27 fixed comment block. 2010-03-04 20:27:07 +09:00
mattn
40a44a60c8 text comment block. 2010-03-04 19:39:03 +09:00
mattn
a81f95f02f fixed html tag parser. 2010-03-04 19:16:43 +09:00
mattn
f91c1f4b64 fixed endless loop in zen_imageSize. 2010-03-04 19:09:27 +09:00
mattn
60a8850e7c oops 2010-03-04 19:06:50 +09:00
mattn
5fadd04e14 fixed comment block. 2010-03-04 18:25:20 +09:00
mattn
304586f056 add doc. 2010-03-04 17:33:43 +09:00
mattn
f1e11a5fae add few methods. (drastic) 2010-03-04 17:30:16 +09:00
mattn
671226c005 refact & add image size (in progress) 2010-03-04 03:19:14 +09:00
mattn
ab37be12b1 disable user_zen_settings for unit test. 2010-03-04 03:18:27 +09:00
mattn
cc1845bbad fix doc. 2010-03-03 18:36:19 +09:00
mattn
571654c416 rename 2010-03-03 18:34:08 +09:00
mattn
d314aac8e5 add README 2010-03-03 18:32:42 +09:00
mattn
6f131081df next/prev 2010-03-03 18:32:19 +09:00
mattn
39978b46da fixed doc. 2010-03-03 11:00:50 +09:00
mattn
aa53f1a1b9 oops 2010-03-03 10:59:50 +09:00
mattn
e7727ecd3a inline elements 2010-03-03 10:57:33 +09:00
mattn
10529b0fd2 fixed problem that can't work on the part of multibyte characters. 2010-03-03 10:16:49 +09:00
mattn
3fa5f954b5 fixed test. 2010-03-02 20:11:30 +09:00
mattn
7b53ee106b title should be below of meta-charset. 2010-03-02 14:15:28 +09:00
mattn
b70c4881d9 colorfull 2010-03-01 18:17:50 +09:00
mattn
50cc0229f0 benchmark 2010-03-01 17:59:19 +09:00
mattn
3c4e5deb1c be possible to work as plugin and ftplugin both. 2010-03-01 17:59:08 +09:00
mattn
8de8625b6f test test test. 2010-03-01 15:05:06 +09:00
mattn
dfa521dabd test case. 2010-03-01 15:00:18 +09:00
mattn
71e739e770 grouping. 2010-03-01 14:48:32 +09:00
mattn
d2a98bbc0a load zencoding.vim from unittest.vim 2010-03-01 14:23:10 +09:00
mattn
a84a668b3b add unit tests. 2010-03-01 14:21:29 +09:00
mattn
cacb5b4715 Merge branch 'master' of github.com:mattn/zencoding-vim
Conflicts:
	zencoding.vim
2010-03-01 14:21:03 +09:00
mattn
e3397ed866 separate unit test. 2010-03-01 14:20:13 +09:00
30 changed files with 6760 additions and 3733 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/doc/tags

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "docs"]
path = docs
url = https://github.com/mattn/emmet-vim
branch = gh-pages

11
Makefile Normal file
View File

@@ -0,0 +1,11 @@
all : emmet-vim.zip
remove-zip:
-rm doc/tags
-rm emmet-vim.zip
emmet-vim.zip: remove-zip
zip -r emmet-vim.zip autoload plugin doc
release: emmet-vim.zip
vimup update-script emmet.vim

147
README.mkd Normal file
View File

@@ -0,0 +1,147 @@
# Emmet-vim
[emmet-vim](http://mattn.github.com/emmet-vim) is a vim plug-in
which provides support for expanding abbreviations similar to
[emmet](http://emmet.io/).
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mattn/emmet-vim/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
## Installation
[Download zip file](http://www.vim.org/scripts/script.php?script_id=2981):
cd ~/.vim
unzip emmet-vim.zip
To install using pathogen.vim:
cd ~/.vim/bundle
git clone https://github.com/mattn/emmet-vim.git
To install using [Vundle](https://github.com/gmarik/vundle):
" add this line to your .vimrc file
Plugin 'mattn/emmet-vim'
To checkout the source from repository:
cd ~/.vim/bundle
git clone https://github.com/mattn/emmet-vim.git
or:
git clone https://github.com/mattn/emmet-vim.git
cd emmet-vim
cp plugin/emmet.vim ~/.vim/plugin/
cp autoload/emmet.vim ~/.vim/autoload/
cp -a autoload/emmet ~/.vim/autoload/
## Quick Tutorial
Open or create a New File:
vim index.html
Type ("\_" is the cursor position):
html:5_
Then type `<c-y>,` (<kbd>Ctrl</kbd><kbd>y</kbd><kbd>,</kbd>), and you should see:
```html
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
_
</body>
</html>
```
[More Tutorials](https://raw.github.com/mattn/emmet-vim/master/TUTORIAL)
## Enable in different mode
If you don't want to enable emmet in all modes,
you can use set these options in `vimrc`:
```vim
let g:user_emmet_mode='n' "only enable normal mode functions.
let g:user_emmet_mode='inv' "enable all functions, which is equal to
let g:user_emmet_mode='a' "enable all function in all mode.
```
## Enable just for html/css
```vim
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
```
## Redefine trigger key
To remap the default `<C-Y>` leader:
```vim
let g:user_emmet_leader_key='<C-Z>'
```
Note that the trailing `,` still needs to be entered, so the new keymap would be `<C-Z>,`.
## Adding custom snippets
If you have installed the [web-api](https://github.com/mattn/webapi-vim) for **emmet-vim** you can also add your own snippets using a custom **snippets.json** file.
Once you have installed the [web-api](https://github.com/mattn/webapi-vim) add this line to your **.vimrc**:
```
let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.snippets_custom.json')), "\n"))
```
You can change the **path** to your **snippets_custom.json** according to your preferences.
[Here](http://docs.emmet.io/customization/snippets/) you can find instructions about creating your customized **snippets.json** file.
## Project Authors
[Yasuhiro Matsumoto](http://mattn.kaoriya.net/)
## Links
### Emmet official site:
* <http://emmet.io/>
### zen-coding official site:
* <http://code.google.com/p/zen-coding/>
### emmet.vim:
* <http://mattn.github.com/emmet-vim>
### development repository:
* <https://github.com/mattn/emmet-vim>
### my blog posts about zencoding-vim:
* <http://mattn.kaoriya.net/software/vim/20100222103327.htm>
* <http://mattn.kaoriya.net/software/vim/20100306021632.htm>
### Japanese blog posts about zencoding-vim:
* <http://d.hatena.ne.jp/idesaku/20100424/1272092255>
* <http://d.hatena.ne.jp/griefworker/20110118/vim_zen_coding>
* <http://d.hatena.ne.jp/sakurako_s/20110126/1295988873>
* <http://looxu.blogspot.jp/2010/02/zencodingvimhtml.html>
### A Chinese translation of the tutorial:
* <http://www.zfanw.com/blog/zencoding-vim-tutorial-chinese.html>

0
TODO Normal file
View File

212
TUTORIAL Normal file
View File

@@ -0,0 +1,212 @@
Tutorial for Emmet.vim
mattn <mattn.jp@gmail.com>
1. Expand an Abbreviation
Type the abbreviation as 'div>p#foo$*3>a' and type '<c-y>,'.
---------------------
<div>
<p id="foo1">
<a href=""></a>
</p>
<p id="foo2">
<a href=""></a>
</p>
<p id="foo3">
<a href=""></a>
</p>
</div>
---------------------
2. Wrap with an Abbreviation
Write as below.
---------------------
test1
test2
test3
---------------------
Then do visual select(line wise) and type '<c-y>,'.
Once you get to the 'Tag:' prompt, type 'ul>li*'.
---------------------
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
</ul>
---------------------
If you type a tag, such as 'blockquote', then you'll see the following:
---------------------
<blockquote>
test1
test2
test3
</blockquote>
---------------------
3. Balance a Tag Inward
type '<c-y>d' in insert mode.
4. Balance a Tag Outward
type '<c-y>D' in insert mode.
5. Go to the Next Edit Point
type '<c-y>n' in insert mode.
6. Go to the Previous Edit Point
type '<c-y>N' in insert mode.
7. Update an <img>s Size
Move cursor to the img tag.
---------------------
<img src="foo.png" />
---------------------
Type '<c-y>i' on img tag
---------------------
<img src="foo.png" width="32" height="48" />
---------------------
8. Merge Lines
select the lines, which include '<li>'
---------------------
<ul>
<li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
---------------------
and then type '<c-y>m'
---------------------
<ul>
<li class="list1"></li><li class="list2"></li><li class="list3"></li>
</ul>
---------------------
9. Remove a Tag
Move cursor in block
---------------------
<div class="foo">
<a>cursor is here</a>
</div>
---------------------
Type '<c-y>k' in insert mode.
---------------------
<div class="foo">
</div>
---------------------
And type '<c-y>k' in there again.
---------------------
---------------------
10. Split/Join Tag
Move the cursor inside block
---------------------
<div class="foo">
cursor is here
</div>
---------------------
Type '<c-y>j' in insert mode.
---------------------
<div class="foo"/>
---------------------
And then type '<c-y>j' in there again.
---------------------
<div class="foo">
</div>
---------------------
11. Toggle Comment
Move cursor inside the block
---------------------
<div>
hello world
</div>
---------------------
Type '<c-y>/' in insert mode.
---------------------
<!-- <div>
hello world
</div> -->
---------------------
Type '<c-y>/' in there again.
---------------------
<div>
hello world
</div>
---------------------
12. Make an anchor from a URL
Move cursor to URL
---------------------
http://www.google.com/
---------------------
Type '<c-y>a'
---------------------
<a href="http://www.google.com/">Google</a>
---------------------
13. Make some quoted text from a URL
Move cursor to the URL
---------------------
http://github.com/
---------------------
Type '<c-y>A'
---------------------
<blockquote class="quote">
<a href="http://github.com/">Secure source code hosting and collaborative development - GitHub</a><br />
<p>How does it work? Get up and running in seconds by forking a project, pushing an existing repository...</p>
<cite>http://github.com/</cite>
</blockquote>
---------------------
14. Installing emmet.vim for the language you are using:
# cd ~/.vim
# unzip emmet-vim.zip
Or if you are using pathogen.vim:
# cd ~/.vim/bundle # or make directory
# unzip /path/to/emmet-vim.zip
Or if you get the sources from the repository:
# cd ~/.vim/bundle # or make directory
# git clone http://github.com/mattn/emmet-vim.git
15. Enable emmet.vim for the language you using.
You can customize the behavior of the languages you are using.
---------------------
# cat >> ~/.vimrc
let g:user_emmet_settings = {
\ 'php' : {
\ 'extends' : 'html',
\ 'filters' : 'c',
\ },
\ 'xml' : {
\ 'extends' : 'html',
\ },
\ 'haml' : {
\ 'extends' : 'html',
\ },
\}
---------------------

1871
autoload/emmet.vim Normal file

File diff suppressed because it is too large Load Diff

11
autoload/emmet/lang.vim Normal file
View File

@@ -0,0 +1,11 @@
let s:exists = {}
function! emmet#lang#exists(type) abort
if len(a:type) == 0
return 0
elseif has_key(s:exists, a:type)
return s:exists[a:type]
endif
let s:exists[a:type] = len(globpath(&rtp, 'autoload/emmet/lang/'.a:type.'.vim')) > 0
return s:exists[a:type]
endfunction

330
autoload/emmet/lang/css.vim Normal file
View File

@@ -0,0 +1,330 @@
function! emmet#lang#css#findTokens(str) abort
return substitute(substitute(a:str, '^.*[;{]\s*', '', ''), '}\s*$', '', '')
endfunction
function! emmet#lang#css#parseIntoTree(abbr, type) abort
let abbr = a:abbr
let type = a:type
let prefix = 0
let value = ''
let indent = emmet#getIndentation(type)
let aliases = emmet#getResource(type, 'aliases', {})
let snippets = emmet#getResource(type, 'snippets', {})
let use_pipe_for_cursor = emmet#getResource(type, 'use_pipe_for_cursor', 1)
let root = emmet#newNode()
" emmet
let tokens = split(abbr, '+\ze[^+)!]')
let block = emmet#util#searchRegion('{', '}')
if abbr !~# '^@' && emmet#getBaseType(type) ==# 'css' && type !=# 'sass' && block[0] ==# [0,0] && block[1] ==# [0,0]
let current = emmet#newNode()
let current.snippet = abbr . " {\n" . indent . "${cursor}\n}"
let current.name = ''
call add(root.child, deepcopy(current))
else
for n in range(len(tokens))
let token = tokens[n]
let prop = matchlist(token, '^\(-\{0,1}[a-zA-Z]\+\|[a-zA-Z0-9]\++\{0,1}\|([a-zA-Z0-9]\++\{0,1})\)\(\%([0-9.-]\+[pe]\{0,1}-\{0,1}\|-auto\)*\)$')
if len(prop)
let token = substitute(prop[1], '^(\(.*\))', '\1', '')
if token =~# '^-'
let prefix = 1
let token = token[1:]
endif
let value = ''
for v in split(prop[2], '\d\zs-')
if len(value) > 0
let value .= ' '
endif
if token =~# '^[z]'
" TODO
let value .= substitute(v, '[^0-9.]*$', '', '')
elseif v =~# 'p$'
let value .= substitute(v, 'p$', '%', '')
elseif v =~# 'e$'
let value .= substitute(v, 'e$', 'em', '')
elseif v =~# '\.'
let value .= v . 'em'
elseif v ==# 'auto'
let value .= v
elseif v ==# '0'
let value .= '0'
else
let value .= v . 'px'
endif
endfor
endif
let tag_name = token
if tag_name =~# '.!$'
let tag_name = tag_name[:-2]
let important = 1
else
let important = 0
endif
" make default node
let current = emmet#newNode()
let current.important = important
let current.name = tag_name
" aliases
if has_key(aliases, tag_name)
let current.name = aliases[tag_name]
endif
" snippets
if !empty(snippets)
let snippet_name = tag_name
if !has_key(snippets, snippet_name)
let pat = '^' . join(split(tag_name, '\zs'), '\%(\|[^:-]\+-\)')
let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat')
if len(vv) > 0
let snippet_name = vv[0]
else
let pat = '^' . join(split(tag_name, '\zs'), '\%(\|[^:-]\+-*\)')
let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat')
if len(vv) == 0
let pat = '^' . join(split(tag_name, '\zs'), '[^:]\{-}')
let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat')
if len(vv) == 0
let pat = '^' . join(split(tag_name, '\zs'), '.\{-}')
let vv = filter(sort(keys(snippets)), 'snippets[v:val] =~ pat')
endif
endif
let minl = -1
for vk in vv
let vvs = snippets[vk]
if minl == -1 || len(vvs) < minl
let snippet_name = vk
let minl = len(vvs)
endif
endfor
endif
endif
if has_key(snippets, snippet_name)
let snippet = snippets[snippet_name]
if use_pipe_for_cursor
let snippet = substitute(snippet, '|', '${cursor}', 'g')
endif
let lines = split(snippet, "\n")
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
let current.snippet = join(lines, "\n")
let current.name = ''
let current.snippet = substitute(current.snippet, ';', value . ';', '')
if use_pipe_for_cursor && len(value) > 0
let current.snippet = substitute(current.snippet, '\${cursor}', '', 'g')
endif
if n < len(tokens) - 1
let current.snippet .= "\n"
endif
endif
endif
let current.pos = 0
let lg = matchlist(token, '^\%(linear-gradient\|lg\)(\s*\(\S\+\)\s*,\s*\([^,]\+\)\s*,\s*\([^)]\+\)\s*)$')
if len(lg) == 0
let lg = matchlist(token, '^\%(linear-gradient\|lg\)(\s*\(\S\+\)\s*,\s*\([^,]\+\)\s*)$')
if len(lg)
let [lg[1], lg[2], lg[3]] = ['linear', lg[1], lg[2]]
endif
endif
if len(lg)
let current.name = ''
let current.snippet = printf("background-image:-webkit-gradient(%s, 0 0, 0 100%, from(%s), to(%s));\n", lg[1], lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image:-webkit-linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image:-moz-linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image:-o-linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
let current.snippet = printf("background-image:linear-gradient(%s, %s);\n", lg[2], lg[3])
call add(root.child, deepcopy(current))
elseif prefix
let snippet = current.snippet
let current.snippet = '-webkit-' . snippet . "\n"
call add(root.child, deepcopy(current))
let current.snippet = '-moz-' . snippet . "\n"
call add(root.child, deepcopy(current))
let current.snippet = snippet
call add(root.child, current)
elseif token =~# '^c#\([0-9a-fA-F]\{3}\|[0-9a-fA-F]\{6}\)\(\.[0-9]\+\)\?'
let cs = split(token, '\.')
let current.name = ''
let [r,g,b] = [0,0,0]
if len(cs[0]) == 5
let rgb = matchlist(cs[0], 'c#\(.\)\(.\)\(.\)')
let r = eval('0x'.rgb[1].rgb[1])
let g = eval('0x'.rgb[2].rgb[2])
let b = eval('0x'.rgb[3].rgb[3])
elseif len(cs[0]) == 8
let rgb = matchlist(cs[0], 'c#\(..\)\(..\)\(..\)')
let r = eval('0x'.rgb[1])
let g = eval('0x'.rgb[2])
let b = eval('0x'.rgb[3])
endif
if len(cs) == 1
let current.snippet = printf('color:rgb(%d, %d, %d);', r, g, b)
else
let current.snippet = printf('color:rgb(%d, %d, %d, %s);', r, g, b, string(str2float('0.'.cs[1])))
endif
call add(root.child, current)
elseif token =~# '^c#'
let current.name = ''
let current.snippet = 'color:\${cursor};'
call add(root.child, current)
else
call add(root.child, current)
endif
endfor
endif
return root
endfunction
function! emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent) abort
let current = a:current
let value = current.value[1:-2]
if emmet#useFilter(a:filters, 'fc')
let value = substitute(value, '\([^:]\+\):\([^;]*\)', '\1: \2', 'g')
else
let value = substitute(value, '\([^:]\+\):\([^;]*\)', '\1:\2', 'g')
endif
if current.important
let value = substitute(value, ';', ' !important;', '')
endif
return value
endfunction
function! emmet#lang#css#imageSize() abort
let img_region = emmet#util#searchRegion('{', '}')
if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region)
return
endif
let content = emmet#util#getContent(img_region)
let fn = matchstr(content, '\<url(\zs[^)]\+\ze)')
let fn = substitute(fn, '[''" \t]', '', 'g')
if fn =~# '^\s*$'
return
elseif fn !~# '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = emmet#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let indent = emmet#getIndentation('css')
if content =~# '.*\<width\s*:[^;]*;.*'
let content = substitute(content, '\<width\s*:[^;]*;', 'width: ' . width . 'px;', '')
else
let content = substitute(content, '}', indent . 'width: ' . width . "px;\n}", '')
endif
if content =~# '.*\<height\s*:[^;]*;.*'
let content = substitute(content, '\<height\s*:[^;]*;', 'height: ' . height . 'px;', '')
else
let content = substitute(content, '}', indent . 'height: ' . height . "px;\n}", '')
endif
call emmet#util#setContent(img_region, content)
endfunction
function! emmet#lang#css#encodeImage() abort
endfunction
function! emmet#lang#css#parseTag(tag) abort
return {}
endfunction
function! emmet#lang#css#toggleComment() abort
let line = getline('.')
let mx = '^\(\s*\)/\*\s*\(.*\)\s*\*/\s*$'
if line =~# '{\s*$'
let block = emmet#util#searchRegion('/\*', '\*/\zs')
if emmet#util#regionIsValid(block)
let content = emmet#util#getContent(block)
let content = substitute(content, '/\*\s\(.*\)\s\*/', '\1', '')
call emmet#util#setContent(block, content)
else
let node = expand('<cword>')
if len(node)
exe "normal ciw\<c-r>='/* '.node.' */'\<cr>"
endif
endif
else
if line =~# mx
let space = substitute(matchstr(line, mx), mx, '\1', '')
let line = substitute(matchstr(line, mx), mx, '\2', '')
let line = space . substitute(line, '^\s*\|\s*$', '\1', 'g')
else
let mx = '^\(\s*\)\(.*\)\s*$'
let line = substitute(line, mx, '\1/* \2 */', '')
endif
call setline('.', line)
endif
endfunction
function! emmet#lang#css#balanceTag(flag) range abort
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = emmet#util#getcurpos()
endif
let block = emmet#util#getVisualBlock()
if !emmet#util#regionIsValid(block)
if a:flag > 0
let block = emmet#util#searchRegion('^', ';')
if emmet#util#regionIsValid(block)
call emmet#util#selectRegion(block)
return
endif
endif
else
if a:flag > 0
let content = emmet#util#getContent(block)
if content !~# '^{.*}$'
let block = emmet#util#searchRegion('{', '}')
if emmet#util#regionIsValid(block)
call emmet#util#selectRegion(block)
return
endif
endif
else
let pos = searchpos('.*;', 'nW')
if pos[0] != 0
call setpos('.', [0, pos[0], pos[1], 0])
let block = emmet#util#searchRegion('^', ';')
if emmet#util#regionIsValid(block)
call emmet#util#selectRegion(block)
return
endif
endif
endif
endif
if a:flag == -2 || a:flag == 2
silent! exe 'normal! gv'
else
call setpos('.', curpos)
endif
endfunction
function! emmet#lang#css#moveNextPrevItem(flag) abort
return emmet#lang#css#moveNextPrev(a:flag)
endfunction
function! emmet#lang#css#moveNextPrev(flag) abort
let pos = search('""\|()\|\(:\s*\zs$\)', a:flag ? 'Wbp' : 'Wp')
if pos == 2
startinsert!
else
silent! normal! l
startinsert
endif
endfunction
function! emmet#lang#css#splitJoinTag() abort
" nothing to do
endfunction
function! emmet#lang#css#removeTag() abort
" nothing to do
endfunction

View File

@@ -0,0 +1,335 @@
function! emmet#lang#haml#findTokens(str) abort
return emmet#lang#html#findTokens(a:str)
endfunction
function! emmet#lang#haml#parseIntoTree(abbr, type) abort
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
endfunction
function! emmet#lang#haml#toString(settings, current, type, inline, filters, itemno, indent) abort
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = emmet#getIndentation(type)
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
let attribute_style = emmet#getResource('haml', 'attribute_style', 'hash')
let str = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current.name, '\$$', itemno+1, '')
endif
if len(current.name) > 0
let str .= '%' . current_name
let tmp = ''
for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
if !has_key(current.attr, attr)
continue
endif
let Val = current.attr[attr]
if type(Val) == 2 && Val == function('emmet#types#true')
if attribute_style ==# 'hash'
let tmp .= ' :' . attr . ' => true'
elseif attribute_style ==# 'html'
let tmp .= attr . '=true'
end
else
if dollar_expr
while Val =~# '\$\([^#{]\|$\)'
let Val = substitute(Val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
endif
let valtmp = substitute(Val, '\${cursor}', '', '')
if attr ==# 'id' && len(valtmp) > 0
let str .= '#' . Val
elseif attr ==# 'class' && len(valtmp) > 0
let str .= '.' . substitute(Val, ' ', '.', 'g')
else
if len(tmp) > 0
if attribute_style ==# 'hash'
let tmp .= ','
elseif attribute_style ==# 'html'
let tmp .= ' '
endif
endif
let Val = substitute(Val, '\${cursor}', '', '')
if attribute_style ==# 'hash'
let tmp .= ' :' . attr . ' => "' . Val . '"'
elseif attribute_style ==# 'html'
let tmp .= attr . '="' . Val . '"'
end
endif
endif
endfor
if len(tmp)
if attribute_style ==# 'hash'
let str .= '{' . tmp . ' }'
elseif attribute_style ==# 'html'
let str .= '(' . tmp . ')'
end
endif
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1 && len(current.value) == 0
let str .= '/'
endif
let inner = ''
if len(current.value) > 0
let text = current.value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
let str = substitute(str, '\$#', text, 'g')
endif
let lines = split(text, "\n")
if len(lines) == 1
let str .= ' ' . text
else
for line in lines
let str .= "\n" . indent . line . ' |'
endfor
endif
elseif len(current.child) == 0
let str .= '${cursor}'
endif
if len(current.child) == 1 && len(current.child[0].name) == 0
let text = current.child[0].value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
endif
let lines = split(text, "\n")
if len(lines) == 1
let str .= ' ' . text
else
for line in lines
let str .= "\n" . indent . line . ' |'
endfor
endif
elseif len(current.child) > 0
for child in current.child
let inner .= emmet#toString(child, type, inline, filters, itemno, indent)
endfor
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g')
let str .= "\n" . indent . inner
endif
else
let str = current.value[1:-2]
if dollar_expr
let str = substitute(str, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let str = substitute(str, '\${nr}', "\n", 'g')
let str = substitute(str, '\\\$', '$', 'g')
endif
endif
let str .= "\n"
return str
endfunction
function! emmet#lang#haml#imageSize() abort
let line = getline('.')
let current = emmet#lang#haml#parseTag(line)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn =~# '^\s*$'
return
elseif fn !~# '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = emmet#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let current.attrs_order += ['width', 'height']
let haml = emmet#toString(current, 'haml', 1)
let haml = substitute(haml, '\${cursor}', '', '')
call setline('.', substitute(matchstr(line, '^\s*') . haml, "\n", '', 'g'))
endfunction
function! emmet#lang#haml#encodeImage() abort
endfunction
function! emmet#lang#haml#parseTag(tag) abort
let current = emmet#newNode()
let mx = '%\([a-zA-Z][a-zA-Z0-9]*\)\s*\%({\(.*\)}\)'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', '')
let attrs = substitute(match, mx, '\2', '')
let mx = '\([a-zA-Z0-9]\+\)\s*=>\s*\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)
if len(match) ==# 0
break
endif
let attr_match = matchlist(match, mx)
let name = attr_match[1]
let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
let current.attr[name] = value
let current.attrs_order += [name]
let attrs = attrs[stridx(attrs, match) + len(match):]
endwhile
return current
endfunction
function! emmet#lang#haml#toggleComment() abort
let line = getline('.')
let space = matchstr(line, '^\s*')
if line =~# '^\s*-#'
call setline('.', space . matchstr(line[len(space)+2:], '^\s*\zs.*'))
elseif line =~# '^\s*%[a-z]'
call setline('.', space . '-# ' . line[len(space):])
endif
endfunction
function! emmet#lang#haml#balanceTag(flag) range abort
let block = emmet#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = emmet#util#getcurpos()
endif
let n = curpos[1]
let ml = len(matchstr(getline(n), '^\s*'))
if a:flag > 0
if a:flag == 1 || !emmet#util#regionIsValid(block)
let n = line('.')
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze%[a-z]'))
if l > 0 && l < ml
let ml = l
break
endif
let n -= 1
endwhile
endif
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*%[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l > ml
let ml = l
break
endif
let n += 1
endwhile
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*%[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
endif
endfunction
function! emmet#lang#haml#moveNextPrevItem(flag) abort
return emmet#lang#haml#moveNextPrev(a:flag)
endfunction
function! emmet#lang#haml#moveNextPrev(flag) abort
let pos = search('""', a:flag ? 'Wb' : 'W')
if pos != 0
silent! normal! l
startinsert
endif
endfunction
function! emmet#lang#haml#splitJoinTag() abort
let n = line('.')
let sml = len(matchstr(getline(n), '^\s*%[a-z]'))
while n > 0
if getline(n) =~# '^\s*\ze%[a-z]'
if len(matchstr(getline(n), '^\s*%[a-z]')) < sml
break
endif
let line = getline(n)
call setline(n, substitute(line, '^\s*%\w\+\%(\s*{[^}]*}\|\s\)\zs.*', '', ''))
let sn = n
let n += 1
let ml = len(matchstr(getline(n), '^\s*%[a-z]'))
if len(matchstr(getline(n), '^\s*')) > ml
while n <= line('$')
let l = len(matchstr(getline(n), '^\s*'))
if l <= ml
break
endif
exe n 'delete'
endwhile
call setpos('.', [0, sn, 1, 0])
else
let tag = matchstr(getline(sn), '^\s*%\zs\(\w\+\)')
let spaces = matchstr(getline(sn), '^\s*')
let settings = emmet#getSettings()
if stridx(','.settings.html.inline_elements.',', ','.tag.',') == -1
call append(sn, spaces . ' ')
call setpos('.', [0, sn+1, 1, 0])
else
call setpos('.', [0, sn, 1, 0])
endif
startinsert!
endif
break
endif
let n -= 1
endwhile
endfunction
function! emmet#lang#haml#removeTag() abort
let n = line('.')
let ml = 0
while n > 0
if getline(n) =~# '^\s*\ze[a-z]'
let ml = len(matchstr(getline(n), '^\s*%[a-z]'))
break
endif
let n -= 1
endwhile
let sn = n
while n < line('$')
let l = len(matchstr(getline(n), '^\s*%[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
if sn == n
exe 'delete'
else
exe sn ',' (n-1) 'delete'
endif
endfunction

View File

@@ -0,0 +1,847 @@
let s:mx = '\([+>]\|[<^]\+\)\{-}\s*'
\ .'\((*\)\{-}\s*'
\ .'\([@#.]\{-}[a-zA-Z_\!][a-zA-Z0-9:_\!\-$]*\|{\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}*[ \t\r\n}]*\|\[[^\]]\+\]\)'
\ .'\('
\ .'\%('
\ .'\%(#{[{}a-zA-Z0-9_\-\$]\+\|#[a-zA-Z0-9_\-\$]\+\)'
\ .'\|\%(\[\%("[^"]*"\|[^"\]]*\)\+\]\)'
\ .'\|\%(\.{[{}a-zA-Z0-9_\-\$]\+\|\.[a-zA-Z0-9_\-\$]\+\)'
\ .'\)*'
\ .'\)'
\ .'\%(\({\%([^$}]\+\|\$#\|\${\w\+}\|\$\+\)*}\+\)\)\{0,1}'
\ .'\%(\(@-\{0,1}[0-9]*\)\{0,1}\*\([0-9]\+\)\)\{0,1}'
\ .'\(\%()\%(\(@-\{0,1}[0-9]*\)\{0,1}\*[0-9]\+\)\{0,1}\)*\)'
function! emmet#lang#html#findTokens(str) abort
let str = a:str
let [pos, last_pos] = [0, 0]
while 1
let tag = matchstr(str, '<[a-zA-Z].\{-}>', pos)
if len(tag) == 0
break
endif
let pos = stridx(str, tag, pos) + len(tag)
endwhile
let last_pos = pos
while len(str) > 0
let token = matchstr(str, s:mx, pos)
if token ==# ''
break
endif
if token =~# '^\s'
let token = matchstr(token, '^\s*\zs.*')
let last_pos = stridx(str, token, pos)
endif
let pos = stridx(str, token, pos) + len(token)
endwhile
let str = a:str[last_pos :-1]
if str =~# '^\w\+="[^"]*$'
return ''
endif
return str
endfunction
function! emmet#lang#html#parseIntoTree(abbr, type) abort
let abbr = a:abbr
let type = a:type
let settings = emmet#getSettings()
if !has_key(settings, type)
let type = 'html'
endif
if len(type) == 0 | let type = 'html' | endif
let settings = emmet#getSettings()
let indent = emmet#getIndentation(type)
" try 'foo' to (foo-x)
let rabbr = emmet#getExpandos(type, abbr)
if rabbr == abbr
" try 'foo+(' to (foo-x)
let rabbr = substitute(abbr, '\%(+\|^\)\([a-zA-Z][a-zA-Z0-9+]\+\)+\([(){}>]\|$\)', '\="(".emmet#getExpandos(type, submatch(1)).")".submatch(2)', 'i')
endif
let abbr = rabbr
let root = emmet#newNode()
let parent = root
let last = root
let pos = []
while len(abbr)
" parse line
let match = matchstr(abbr, s:mx)
let str = substitute(match, s:mx, '\0', 'ig')
let operator = substitute(match, s:mx, '\1', 'ig')
let block_start = substitute(match, s:mx, '\2', 'ig')
let tag_name = substitute(match, s:mx, '\3', 'ig')
let attributes = substitute(match, s:mx, '\4', 'ig')
let value = substitute(match, s:mx, '\5', 'ig')
let basevalue = substitute(match, s:mx, '\6', 'ig')
let multiplier = 0 + substitute(match, s:mx, '\7', 'ig')
let block_end = substitute(match, s:mx, '\8', 'ig')
let important = 0
if len(str) == 0
break
endif
if tag_name =~# '^#'
let attributes = tag_name . attributes
let tag_name = 'div'
endif
if tag_name =~# '[^!]!$'
let tag_name = tag_name[:-2]
let important = 1
endif
if tag_name =~# '^\.'
let attributes = tag_name . attributes
let tag_name = 'div'
endif
if tag_name =~# '^\[.*\]$'
let attributes = tag_name . attributes
let tag_name = 'div'
endif
let basedirect = basevalue[1] ==# '-' ? -1 : 1
let basevalue = 0 + abs(basevalue[1:])
if multiplier <= 0 | let multiplier = 1 | endif
" make default node
let current = emmet#newNode()
let current.name = tag_name
let current.important = important
" aliases
let aliases = emmet#getResource(type, 'aliases', {})
if has_key(aliases, tag_name)
let current.name = aliases[tag_name]
endif
let use_pipe_for_cursor = emmet#getResource(type, 'use_pipe_for_cursor', 1)
" snippets
let snippets = emmet#getResource(type, 'snippets', {})
if !empty(snippets)
let snippet_name = tag_name
if has_key(snippets, snippet_name)
let snippet = snippet_name
while has_key(snippets, snippet)
let snippet = snippets[snippet]
endwhile
if use_pipe_for_cursor
let snippet = substitute(snippet, '|', '${cursor}', 'g')
endif
let lines = split(snippet, "\n", 1)
call map(lines, 'substitute(v:val, "\\( \\|\\t\\)", escape(indent, "\\\\"), "g")')
let current.snippet = join(lines, "\n")
let current.name = ''
endif
endif
let custom_expands = emmet#getResource(type, 'custom_expands', {})
if empty(custom_expands) && has_key(settings, 'custom_expands')
let custom_expands = settings['custom_expands']
endif
for k in keys(custom_expands)
if tag_name =~# k
let current.snippet = '${' . tag_name . '}'
let current.name = ''
break
endif
endfor
" default_attributes
let default_attributes = emmet#getResource(type, 'default_attributes', {})
if !empty(default_attributes)
for pat in [current.name, tag_name]
if has_key(default_attributes, pat)
if type(default_attributes[pat]) == 4
let a = default_attributes[pat]
let current.attrs_order += keys(a)
if use_pipe_for_cursor
for k in keys(a)
let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}'
endfor
else
for k in keys(a)
let current.attr[k] = a[k]
endfor
endif
else
for a in default_attributes[pat]
let current.attrs_order += keys(a)
if use_pipe_for_cursor
for k in keys(a)
let current.attr[k] = len(a[k]) ? substitute(a[k], '|', '${cursor}', 'g') : '${cursor}'
endfor
else
for k in keys(a)
let current.attr[k] = a[k]
endfor
endif
endfor
endif
if has_key(settings.html.default_attributes, current.name)
let current.name = substitute(current.name, ':.*$', '', '')
endif
break
endif
endfor
endif
" parse attributes
if len(attributes)
let attr = attributes
while len(attr)
let item = matchstr(attr, '\(\%(\%(#[{}a-zA-Z0-9_\-\$]\+\)\|\%(\[\%("[^"]*"\|[^"\]]*\)\+\]\)\|\%(\.[{}a-zA-Z0-9_\-\$]\+\)*\)\)')
if g:emmet_debug > 1
echomsg 'attr=' . item
endif
if len(item) == 0
break
endif
if item[0] ==# '#'
let current.attr.id = item[1:]
endif
if item[0] ==# '.'
let current.attr.class = substitute(item[1:], '\.', ' ', 'g')
endif
if item[0] ==# '['
let atts = item[1:-2]
if matchstr(atts, '^\s*\zs[0-9a-zA-Z-:]\+\(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\)') ==# ''
let ks = []
if has_key(default_attributes, current.name)
let dfa = default_attributes[current.name]
let ks = type(dfa) == 3 ? keys(dfa[0]) : keys(dfa)
endif
if len(ks) == 0 && has_key(default_attributes, current.name . ':src')
let ks = keys(default_attributes[current.name . ':src'])
endif
if len(ks) > 0
let current.attr[ks[0]] = atts
else
let current.attr[atts] = ''
endif
else
while len(atts)
let amat = matchstr(atts, '^\s*\zs\([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|=[^ ''"]\+\|[^ ''"\]]*\)\{0,1}\)')
if len(amat) == 0
break
endif
let key = split(amat, '=')[0]
let Val = amat[len(key)+1:]
if key =~# '\.$' && Val ==# ''
let key = key[:-2]
unlet Val
let Val = function('emmet#types#true')
elseif Val =~# '^["'']'
let Val = Val[1:-2]
endif
let current.attr[key] = Val
if index(current.attrs_order, key) == -1
let current.attrs_order += [key]
endif
let atts = atts[stridx(atts, amat) + len(amat):]
unlet Val
endwhile
endif
endif
let attr = substitute(strpart(attr, len(item)), '^\s*', '', '')
endwhile
endif
" parse text
if tag_name =~# '^{.*}$'
let current.name = ''
let current.value = tag_name
else
let current.value = value
endif
let current.basedirect = basedirect
let current.basevalue = basevalue
let current.multiplier = multiplier
" parse step inside/outside
if !empty(last)
if operator =~# '>'
unlet! parent
let parent = last
let current.parent = last
let current.pos = last.pos + 1
else
let current.parent = parent
let current.pos = last.pos
endif
else
let current.parent = parent
let current.pos = 1
endif
if operator =~# '[<^]'
for c in range(len(operator))
let tmp = parent.parent
if empty(tmp)
break
endif
let parent = tmp
let current.parent = tmp
endfor
endif
call add(parent.child, current)
let last = current
" parse block
if block_start =~# '('
if operator =~# '>'
let last.pos += 1
endif
for n in range(len(block_start))
let pos += [last.pos]
endfor
endif
if block_end =~# ')'
for n in split(substitute(substitute(block_end, ' ', '', 'g'), ')', ',),', 'g'), ',')
if n ==# ')'
if len(pos) > 0 && last.pos >= pos[-1]
for c in range(last.pos - pos[-1])
let tmp = parent.parent
if !has_key(tmp, 'parent')
break
endif
let parent = tmp
endfor
if len(pos) > 0
call remove(pos, -1)
endif
let last = parent
let last.pos += 1
endif
elseif len(n)
let cl = last.child
let cls = []
for c in range(n[1:])
for cc in cl
if cc.multiplier > 1
let cc.basedirect = c + 1
else
let cc.basevalue = c + 1
endif
endfor
let cls += deepcopy(cl)
endfor
let last.child = cls
endif
endfor
endif
let abbr = abbr[stridx(abbr, match) + len(match):]
if g:emmet_debug > 1
echomsg 'str='.str
echomsg 'block_start='.block_start
echomsg 'tag_name='.tag_name
echomsg 'operator='.operator
echomsg 'attributes='.attributes
echomsg 'value='.value
echomsg 'basevalue='.basevalue
echomsg 'multiplier='.multiplier
echomsg 'block_end='.block_end
echomsg 'abbr='.abbr
echomsg 'pos='.string(pos)
echomsg '---'
endif
endwhile
return root
endfunction
function! s:dollar_add(base,no) abort
if a:base > 0
return a:base + a:no - 1
elseif a:base < 0
return a:base - a:no + 1
else
return a:no
endif
endfunction
function! emmet#lang#html#toString(settings, current, type, inline, filters, itemno, indent) abort
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
let q = emmet#getResource(type, 'quote_char', '"')
let ct = emmet#getResource(type, 'comment_type', 'both')
if emmet#useFilter(filters, 'haml')
return emmet#lang#haml#toString(settings, current, type, inline, filters, itemno, indent)
endif
if emmet#useFilter(filters, 'slim')
return emmet#lang#slim#toString(settings, current, type, inline, filters, itemno, indent)
endif
let comment = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current_name, '\$$', itemno+1, '')
endif
let str = ''
if len(current_name) == 0
let text = current.value[1:-2]
if dollar_expr
" TODO: regexp engine specified
let nr = itemno + 1
if exists('&regexpengine')
let text = substitute(text, '\%#=1\%(\\\)\@\<!\(\$\+\)\(@-\?[0-9]\+\)\{0,1}\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d",s:dollar_add(submatch(2)[1:],nr)).submatch(3)', 'g')
else
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\(@-\?[0-9]\+\)\{0,1}\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d",s:dollar_add(submatch(2)[1:],nr).submatch(3)', 'g')
endif
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
endif
return text
endif
if len(current_name) > 0
let str .= '<' . current_name
endif
for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
if !has_key(current.attr, attr)
continue
endif
let Val = current.attr[attr]
if type(Val) == 2 && Val == function('emmet#types#true')
unlet Val
let Val = 'true'
if g:emmet_html5
let str .= ' ' . attr
else
let str .= ' ' . attr . '=' . q . attr . q
endif
if emmet#useFilter(filters, 'c')
if attr ==# 'id' | let comment .= '#' . Val | endif
if attr ==# 'class' | let comment .= '.' . Val | endif
endif
else
if dollar_expr
while Val =~# '\$\([^#{]\|$\)'
" TODO: regexp engine specified
if exists('&regexpengine')
let Val = substitute(Val, '\%#=1\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
else
let Val = substitute(Val, '\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endif
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
endif
if attr ==# 'class' && emmet#useFilter(filters, 'bem')
let vals = split(Val, '\s\+')
let Val = ''
let lead = ''
for _val in vals
if len(Val) > 0
let Val .= ' '
endif
if _val =~# '^\a_'
let lead = _val[0]
let Val .= lead . ' ' . _val
elseif _val =~# '^_'
if len(lead) == 0
let pattr = current.parent.attr
if has_key(pattr, 'class')
let lead = pattr['class']
endif
endif
let Val .= lead . ' ' . lead . _val
else
let Val .= _val
endif
endfor
endif
let str .= ' ' . attr . '=' . q . Val . q
if emmet#useFilter(filters, 'c')
if attr ==# 'id' | let comment .= '#' . Val | endif
if attr ==# 'class' | let comment .= '.' . Val | endif
endif
endif
unlet Val
endfor
if len(comment) > 0 && ct ==# 'both'
let str = '<!-- ' . comment . " -->\n" . str
endif
if stridx(','.settings.html.empty_elements.',', ','.current_name.',') != -1
let str .= settings.html.empty_element_suffix
else
let str .= '>'
let text = current.value[1:-2]
if dollar_expr
" TODO: regexp engine specified
let nr = itemno + 1
if exists('&regexpengine')
let text = substitute(text, '\%#=1\%(\\\)\@\<!\(\$\+\)\(@-\?[0-9]\+\)\{0,1}\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d",s:dollar_add(submatch(2)[1:],nr)).submatch(3)', 'g')
else
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\(@-\?[0-9]\+\)\{0,1}\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d",s:dollar_add(submatch(2)[1:],nr)).submatch(3)', 'g')
endif
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
let str = substitute(str, '\("\zs$#\ze"\|\s\zs\$#"\|"\$#\ze\s\)', text, 'g')
endif
let str .= text
let nc = len(current.child)
let dr = 0
if nc > 0
for n in range(nc)
let child = current.child[n]
if child.multiplier > 1
let str .= "\n" . indent
let dr = 1
elseif len(current_name) > 0 && stridx(','.settings.html.inline_elements.',', ','.current_name.',') == -1
if nc > 1 || (len(child.name) > 0 && stridx(','.settings.html.inline_elements.',', ','.child.name.',') == -1)
let str .= "\n" . indent
let dr = 1
elseif current.multiplier == 1 && nc == 1 && len(child.name) == 0
let str .= "\n" . indent
let dr = 1
endif
endif
let inner = emmet#toString(child, type, 0, filters, itemno, indent)
let inner = substitute(inner, "^\n", '', 'g')
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g')
let str .= inner
endfor
else
let str .= '${cursor}'
endif
if dr
let str .= "\n"
endif
let str .= '</' . current_name . '>'
endif
if len(comment) > 0
if ct ==# 'lastonly'
let str .= '<!-- ' . comment . ' -->'
else
let str .= "\n<!-- /" . comment . ' -->'
endif
endif
if len(current_name) > 0 && current.multiplier > 0 || stridx(','.settings.html.block_elements.',', ','.current_name.',') != -1
let str .= "\n"
endif
return str
endfunction
function! emmet#lang#html#imageSize() abort
let img_region = emmet#util#searchRegion('<img\s', '>')
if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region)
return
endif
let content = emmet#util#getContent(img_region)
if content !~# '^<img[^><]\+>$'
return
endif
let current = emmet#lang#html#parseTag(content)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn =~# '^\s*$'
return
elseif fn !~# '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = emmet#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let current.attrs_order += ['width', 'height']
let html = substitute(emmet#toString(current, 'html', 1), '\n', '', '')
let html = substitute(html, '\${cursor}', '', '')
call emmet#util#setContent(img_region, html)
endfunction
function! emmet#lang#html#encodeImage() abort
let img_region = emmet#util#searchRegion('<img\s', '>')
if !emmet#util#regionIsValid(img_region) || !emmet#util#cursorInRegion(img_region)
return
endif
let content = emmet#util#getContent(img_region)
if content !~# '^<img[^><]\+>$'
return
endif
let current = emmet#lang#html#parseTag(content)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn !~# '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = emmet#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let html = emmet#toString(current, 'html', 1)
call emmet#util#setContent(img_region, html)
endfunction
function! emmet#lang#html#parseTag(tag) abort
let current = emmet#newNode()
let mx = '<\([a-zA-Z][a-zA-Z0-9]*\)\(\%(\s[a-zA-Z][a-zA-Z0-9]\+=\%([^"'' \t]\+\|"[^"]\{-}"\|''[^'']\{-}''\)\s*\)*\)\(/\{0,1}\)>'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', 'i')
let attrs = substitute(match, mx, '\2', 'i')
let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)
if len(match) == 0
break
endif
let attr_match = matchlist(match, mx)
let name = attr_match[1]
let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
let current.attr[name] = value
let current.attrs_order += [name]
let attrs = attrs[stridx(attrs, match) + len(match):]
endwhile
return current
endfunction
function! emmet#lang#html#toggleComment() abort
let orgpos = emmet#util#getcurpos()
let curpos = emmet#util#getcurpos()
let mx = '<\%#[^>]*>'
while 1
let block = emmet#util#searchRegion('<!--', '-->')
if emmet#util#regionIsValid(block)
let block[1][1] += 2
let content = emmet#util#getContent(block)
let content = substitute(content, '^<!--\s\(.*\)\s-->$', '\1', '')
call emmet#util#setContent(block, content)
silent! call setpos('.', orgpos)
return
endif
let block = emmet#util#searchRegion('<[^>]', '>')
if !emmet#util#regionIsValid(block)
let pos1 = searchpos('<', 'bcW')
if pos1[0] == 0 && pos1[1] == 0
return
endif
let curpos = emmet#util#getcurpos()
continue
endif
let pos1 = block[0]
let pos2 = block[1]
let content = emmet#util#getContent(block)
let tag_name = matchstr(content, '^<\zs/\{0,1}[^ \r\n>]\+')
if tag_name[0] ==# '/'
call setpos('.', [0, pos1[0], pos1[1], 0])
let pos2 = searchpairpos('<'. tag_name[1:] . '\>[^>]*>', '', '</' . tag_name[1:] . '>', 'bnW')
let pos1 = searchpos('>', 'cneW')
let block = [pos2, pos1]
elseif tag_name =~# '/$'
if !emmet#util#pointInRegion(orgpos[1:2], block)
" it's broken tree
call setpos('.', orgpos)
let block = emmet#util#searchRegion('>', '<')
let content = '><!-- ' . emmet#util#getContent(block)[1:-2] . ' --><'
call emmet#util#setContent(block, content)
silent! call setpos('.', orgpos)
return
endif
else
call setpos('.', [0, pos2[0], pos2[1], 0])
let pos3 = searchpairpos('<'. tag_name . '\>[^>]*>', '', '</' . tag_name . '>', 'nW')
if pos3 == [0, 0]
let block = [pos1, pos2]
else
call setpos('.', [0, pos3[0], pos3[1], 0])
let pos2 = searchpos('>', 'neW')
let block = [pos1, pos2]
endif
endif
if !emmet#util#regionIsValid(block)
silent! call setpos('.', orgpos)
return
endif
if emmet#util#pointInRegion(curpos[1:2], block)
let content = '<!-- ' . emmet#util#getContent(block) . ' -->'
call emmet#util#setContent(block, content)
silent! call setpos('.', orgpos)
return
endif
endwhile
endfunction
function! emmet#lang#html#balanceTag(flag) range abort
let vblock = emmet#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = emmet#util#getcurpos()
endif
let settings = emmet#getSettings()
if a:flag > 0
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*'
let last = curpos[1:2]
while 1
let pos1 = searchpos(mx, 'bW')
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1
let pos2 = searchpos('>', 'nW')
else
let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '</'. tag_name . '\zs>', 'nW')
endif
let block = [pos1, pos2]
if pos1[0] == 0 && pos1[1] == 0
break
endif
if emmet#util#pointInRegion(last, block) && emmet#util#regionIsValid(block)
call emmet#util#selectRegion(block)
return
endif
if pos1 == last
break
endif
let last = pos1
endwhile
else
let mx = '<\([a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
while 1
let pos1 = searchpos(mx, 'W')
if pos1 == curpos[1:2]
let pos1 = searchpos(mx . '\zs', 'W')
let pos2 = searchpos('.\ze<', 'W')
let block = [pos1, pos2]
if emmet#util#regionIsValid(block)
call emmet#util#selectRegion(block)
return
endif
endif
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = matchstr(content, '^<\zs[a-zA-Z0-9:_\-]*\ze')
if stridx(','.settings.html.empty_elements.',', ','.tag_name.',') != -1
let pos2 = searchpos('>', 'nW')
else
let pos2 = searchpairpos('<' . tag_name . '[^>]*>', '', '</'. tag_name . '\zs>', 'nW')
endif
let block = [pos1, pos2]
if pos1[0] == 0 && pos1[1] == 0
break
endif
if emmet#util#regionIsValid(block)
call emmet#util#selectRegion(block)
return
endif
endwhile
endif
if a:flag == -2 || a:flag == 2
silent! exe 'normal! gv'
else
call setpos('.', curpos)
endif
endfunction
function! emmet#lang#html#moveNextPrevItem(flag) abort
silent! exe "normal \<esc>"
let mx = '\%([0-9a-zA-Z-:]\+\%(="[^"]*"\|=''[^'']*''\|[^ ''">\]]*\)\{0,1}\)'
let pos = searchpos('\s'.mx.'\zs', '')
if pos != [0,0]
call feedkeys('v?\s\zs'.mx."\<cr>", '')
endif
endfunction
function! emmet#lang#html#moveNextPrev(flag) abort
let pos = search('\%(</\w\+\)\@<!\zs><\/\|\(""\)\|^\(\s*\)$', a:flag ? 'Wpb' : 'Wp')
if pos == 3
startinsert!
elseif pos != 0
silent! normal! l
startinsert
endif
endfunction
function! emmet#lang#html#splitJoinTag() abort
let curpos = emmet#util#getcurpos()
while 1
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*>'
let pos1 = searchpos(mx, 'bcnW')
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = substitute(content, '^<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\).*$', '\1', '')
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
if content[-2:] ==# '/>' && emmet#util#cursorInRegion(block)
let content = content[:-3] . '></' . tag_name . '>'
call emmet#util#setContent(block, content)
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if tag_name[0] ==# '/'
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
call setpos('.', [0, pos1[0], pos1[1], 0])
let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
else
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
endif
let block = [pos1, pos2]
let content = emmet#util#getContent(block)
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~# '<' . tag_name . '[^a-zA-Z0-9]*[^>]*>'
let content = matchstr(content, mx)[:-2] . '/>'
call emmet#util#setContent(block, content)
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if block[0][0] > 0
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
else
call setpos('.', curpos)
return
endif
endif
endif
endwhile
endfunction
function! emmet#lang#html#removeTag() abort
let curpos = emmet#util#getcurpos()
while 1
let mx = '<\(/\{0,1}[a-zA-Z][a-zA-Z0-9:_\-]*\)[^>]*'
let pos1 = searchpos(mx, 'bcnW')
let content = matchstr(getline(pos1[0])[pos1[1]-1:], mx)
let tag_name = matchstr(content, '^<\zs/\{0,1}[a-zA-Z0-9:_\-]*')
let block = [pos1, [pos1[0], pos1[1] + len(content) - 1]]
if content[-2:] ==# '/>' && emmet#util#cursorInRegion(block)
call emmet#util#setContent(block, '')
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if tag_name[0] ==# '/'
let pos1 = searchpos('<' . tag_name[1:] . '[^a-zA-Z0-9]', 'bcnW')
call setpos('.', [0, pos1[0], pos1[1], 0])
let pos2 = searchpos('</' . tag_name[1:] . '>', 'cneW')
else
let pos2 = searchpos('</' . tag_name . '>', 'cneW')
endif
let block = [pos1, pos2]
let content = emmet#util#getContent(block)
if emmet#util#pointInRegion(curpos[1:2], block) && content[1:] !~# '^<' . tag_name . '[^a-zA-Z0-9]'
call emmet#util#setContent(block, '')
call setpos('.', [0, block[0][0], block[0][1], 0])
return
else
if block[0][0] > 0
call setpos('.', [0, block[0][0]-1, block[0][1], 0])
else
call setpos('.', curpos)
return
endif
endif
endif
endwhile
endfunction

View File

@@ -0,0 +1,47 @@
function! emmet#lang#less#findTokens(str) abort
return emmet#lang#html#findTokens(a:str)
endfunction
function! emmet#lang#less#parseIntoTree(abbr, type) abort
return emmet#lang#scss#parseIntoTree(a:abbr, a:type)
endfunction
function! emmet#lang#less#toString(settings, current, type, inline, filters, itemno, indent) abort
return emmet#lang#scss#toString(a:settings, a:current, a:type, a:inline, a:filters, a:itemno, a:indent)
endfunction
function! emmet#lang#less#imageSize() abort
call emmet#lang#css#imageSize()
endfunction
function! emmet#lang#less#encodeImage() abort
return emmet#lang#css#encodeImage()
endfunction
function! emmet#lang#less#parseTag(tag) abort
return emmet#lang#css#parseTag(a:tag)
endfunction
function! emmet#lang#less#toggleComment() abort
call emmet#lang#css#toggleComment()
endfunction
function! emmet#lang#less#balanceTag(flag) range abort
call emmet#lang#scss#balanceTag(a:flag)
endfunction
function! emmet#lang#less#moveNextPrevItem(flag) abort
return emmet#lang#less#moveNextPrev(a:flag)
endfunction
function! emmet#lang#less#moveNextPrev(flag) abort
call emmet#lang#scss#moveNextPrev(a:flag)
endfunction
function! emmet#lang#less#splitJoinTag() abort
call emmet#lang#css#splitJoinTag()
endfunction
function! emmet#lang#less#removeTag() abort
call emmet#lang#css#removeTag()
endfunction

View File

@@ -0,0 +1,160 @@
function! emmet#lang#sass#findTokens(str) abort
return emmet#lang#css#findTokens(a:str)
endfunction
function! emmet#lang#sass#parseIntoTree(abbr, type) abort
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
endfunction
function! emmet#lang#sass#toString(settings, current, type, inline, filters, itemno, indent) abort
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let str = ''
let current_name = current.name
let current_name = substitute(current.name, '\$$', itemno+1, '')
if len(current.name) > 0
let str .= current_name
let tmp = ''
for attr in keys(current.attr)
let val = current.attr[attr]
while val =~# '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
if attr ==# 'id'
let str .= '#' . val
elseif attr ==# 'class'
let str .= '.' . val
else
let tmp .= attr . ': ' . val
endif
endfor
if len(tmp) > 0
let str .= "\n"
for line in split(tmp, "\n")
let str .= indent . line . "\n"
endfor
else
let str .= "\n"
endif
let inner = ''
for child in current.child
let tmp = emmet#toString(child, type, inline, filters, itemno, indent)
let tmp = substitute(tmp, "\n", "\n" . escape(indent, '\'), 'g')
let tmp = substitute(tmp, "\n" . escape(indent, '\') . '$', '${cursor}\n', 'g')
let inner .= tmp
endfor
if len(inner) > 0
let str .= indent . inner
endif
else
let text = emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
let text = substitute(text, '\s*;\ze\(\${[^}]\+}\)\?\(\n\|$\)', '', 'g')
return text
endif
return str
endfunction
function! emmet#lang#sass#imageSize() abort
endfunction
function! emmet#lang#sass#encodeImage() abort
endfunction
function! emmet#lang#sass#parseTag(tag) abort
endfunction
function! emmet#lang#sass#toggleComment() abort
endfunction
function! emmet#lang#sass#balanceTag(flag) range abort
let block = emmet#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = emmet#util#getcurpos()
endif
let n = curpos[1]
let ml = len(matchstr(getline(n), '^\s*'))
if a:flag > 0
if a:flag == 1 || !emmet#util#regionIsValid(block)
let n = line('.')
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l < ml
let ml = l
break
endif
let n -= 1
endwhile
endif
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l > ml
let ml = l
break
endif
let n += 1
endwhile
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
endif
endfunction
function! emmet#lang#sass#moveNextPrevItem(flag) abort
return emmet#lang#sass#moveNextPrev(a:flag)
endfunction
function! emmet#lang#sass#moveNextPrev(flag) abort
let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp')
if pos == 2
startinsert!
elseif pos != 0
silent! normal! l
startinsert
endif
endfunction
function! emmet#lang#sass#splitJoinTag() abort
endfunction
function! emmet#lang#sass#removeTag() abort
endfunction

View File

@@ -0,0 +1,125 @@
function! emmet#lang#scss#findTokens(str) abort
return emmet#lang#css#findTokens(a:str)
endfunction
function! emmet#lang#scss#parseIntoTree(abbr, type) abort
if a:abbr =~# '>'
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
else
return emmet#lang#css#parseIntoTree(a:abbr, a:type)
endif
endfunction
function! emmet#lang#scss#toString(settings, current, type, inline, filters, itemno, indent) abort
let settings = a:settings
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = a:indent
let str = ''
let current_name = substitute(current.name, '\$$', itemno+1, '')
if len(current.name) > 0
let str .= current_name
let tmp = ''
for attr in keys(current.attr)
let val = current.attr[attr]
while val =~# '\$\([^#{]\|$\)'
let val = substitute(val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
let attr = substitute(attr, '\$$', itemno+1, '')
if attr ==# 'id'
let str .= '#' . val
elseif attr ==# 'class'
let str .= '.' . val
else
let tmp .= attr . ': ' . val . ';'
endif
endfor
if len(tmp) > 0
let str .= " {\n"
for line in split(tmp, "\n")
let str .= indent . line . "\n"
endfor
else
let str .= " {\n"
endif
let inner = ''
for child in current.child
let inner .= emmet#toString(child, type, inline, filters, itemno)
endfor
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g')
let str .= indent . inner . "\n}\n"
else
return emmet#lang#css#toString(settings, current, type, inline, filters, itemno, indent)
endif
return str
endfunction
function! emmet#lang#scss#imageSize() abort
call emmet#lang#css#imageSize()
endfunction
function! emmet#lang#scss#encodeImage() abort
return emmet#lang#css#encodeImage()
endfunction
function! emmet#lang#scss#parseTag(tag) abort
return emmet#lang#css#parseTag(a:tag)
endfunction
function! emmet#lang#scss#toggleComment() abort
call emmet#lang#css#toggleComment()
endfunction
function! emmet#lang#scss#balanceTag(flag) range abort
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
call setpos('.', curpos)
else
let curpos = emmet#util#getcurpos()
endif
if a:flag < 0
let ret = searchpair('}', '', '.\zs{')
else
let ret = searchpair('{', '', '}', 'bW')
endif
if ret > 0
let pos1 = emmet#util#getcurpos()[1:2]
if a:flag < 0
let pos2 = searchpairpos('{', '', '}')
else
let pos2 = searchpairpos('{', '', '}')
endif
let block = [pos1, pos2]
if emmet#util#regionIsValid(block)
call emmet#util#selectRegion(block)
return
endif
endif
if a:flag == -2 || a:flag == 2
silent! exe 'normal! gv'
else
call setpos('.', curpos)
endif
endfunction
function! emmet#lang#scss#moveNextPrevItem(flag) abort
return emmet#lang#scss#moveNextPrev(a:flag)
endfunction
function! emmet#lang#scss#moveNextPrev(flag) abort
call emmet#lang#css#moveNextPrev(a:flag)
endfunction
function! emmet#lang#scss#splitJoinTag() abort
call emmet#lang#css#splitJoinTag()
endfunction
function! emmet#lang#scss#removeTag() abort
call emmet#lang#css#removeTag()
endfunction

View File

@@ -0,0 +1,281 @@
function! emmet#lang#slim#findTokens(str) abort
return emmet#lang#html#findTokens(a:str)
endfunction
function! emmet#lang#slim#parseIntoTree(abbr, type) abort
return emmet#lang#html#parseIntoTree(a:abbr, a:type)
endfunction
function! emmet#lang#slim#toString(settings, current, type, inline, filters, itemno, indent) abort
let current = a:current
let type = a:type
let inline = a:inline
let filters = a:filters
let itemno = a:itemno
let indent = emmet#getIndentation(type)
let dollar_expr = emmet#getResource(type, 'dollar_expr', 1)
let str = ''
let current_name = current.name
if dollar_expr
let current_name = substitute(current.name, '\$$', itemno+1, '')
endif
if len(current.name) > 0
let str .= current_name
for attr in emmet#util#unique(current.attrs_order + keys(current.attr))
if !has_key(current.attr, attr)
continue
endif
let Val = current.attr[attr]
if type(Val) == 2 && Val == function('emmet#types#true')
let str .= ' ' . attr . '=true'
else
if dollar_expr
while Val =~# '\$\([^#{]\|$\)'
let Val = substitute(Val, '\(\$\+\)\([^{]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
endwhile
endif
let attr = substitute(attr, '\$$', itemno+1, '')
let str .= ' ' . attr . '="' . Val . '"'
endif
endfor
let inner = ''
if len(current.value) > 0
let str .= "\n"
let text = current.value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
let str = substitute(str, '\$#', text, 'g')
endif
for line in split(text, "\n")
let str .= indent . '| ' . line . "\n"
endfor
elseif len(current.child) == 0
let str .= '${cursor}'
endif
if len(current.child) == 1 && len(current.child[0].name) == 0
let str .= "\n"
let text = current.child[0].value[1:-2]
if dollar_expr
let text = substitute(text, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let text = substitute(text, '\${nr}', "\n", 'g')
let text = substitute(text, '\\\$', '$', 'g')
endif
for line in split(text, "\n")
let str .= indent . '| ' . line . "\n"
endfor
elseif len(current.child) > 0
for child in current.child
let inner .= emmet#toString(child, type, inline, filters, itemno, indent)
endfor
let inner = substitute(inner, "\n", "\n" . escape(indent, '\'), 'g')
let inner = substitute(inner, "\n" . escape(indent, '\') . '$', '', 'g')
let str .= "\n" . indent . inner
endif
else
let str = current.value[1:-2]
if dollar_expr
let str = substitute(str, '\%(\\\)\@\<!\(\$\+\)\([^{#]\|$\)', '\=printf("%0".len(submatch(1))."d", itemno+1).submatch(2)', 'g')
let str = substitute(str, '\${nr}', "\n", 'g')
let str = substitute(str, '\\\$', '$', 'g')
endif
endif
if str !~# "\n$"
let str .= "\n"
endif
return str
endfunction
function! emmet#lang#slim#imageSize() abort
let line = getline('.')
let current = emmet#lang#slim#parseTag(line)
if empty(current) || !has_key(current.attr, 'src')
return
endif
let fn = current.attr.src
if fn =~# '^\s*$'
return
elseif fn !~# '^\(/\|http\)'
let fn = simplify(expand('%:h') . '/' . fn)
endif
let [width, height] = emmet#util#getImageSize(fn)
if width == -1 && height == -1
return
endif
let current.attr.width = width
let current.attr.height = height
let current.attrs_order += ['width', 'height']
let slim = emmet#toString(current, 'slim', 1)
let slim = substitute(slim, '\${cursor}', '', '')
call setline('.', substitute(matchstr(line, '^\s*') . slim, "\n", '', 'g'))
endfunction
function! emmet#lang#slim#encodeImage() abort
endfunction
function! emmet#lang#slim#parseTag(tag) abort
let current = emmet#newNode()
let mx = '\([a-zA-Z][a-zA-Z0-9]*\)\s\+\(.*\)'
let match = matchstr(a:tag, mx)
let current.name = substitute(match, mx, '\1', '')
let attrs = substitute(match, mx, '\2', '')
let mx = '\([a-zA-Z0-9]\+\)=\%(\([^"'' \t]\+\)\|"\([^"]\{-}\)"\|''\([^'']\{-}\)''\)'
while len(attrs) > 0
let match = matchstr(attrs, mx)
if len(match) == 0
break
endif
let attr_match = matchlist(match, mx)
let name = attr_match[1]
let value = len(attr_match[2]) ? attr_match[2] : attr_match[3]
let current.attr[name] = value
let current.attrs_order += [name]
let attrs = attrs[stridx(attrs, match) + len(match):]
endwhile
return current
endfunction
function! emmet#lang#slim#toggleComment() abort
let line = getline('.')
let space = matchstr(line, '^\s*')
if line =~# '^\s*/'
call setline('.', space . line[len(space)+1:])
elseif line =~# '^\s*[a-z]'
call setline('.', space . '/' . line[len(space):])
endif
endfunction
function! emmet#lang#slim#balanceTag(flag) range abort
let block = emmet#util#getVisualBlock()
if a:flag == -2 || a:flag == 2
let curpos = [0, line("'<"), col("'<"), 0]
else
let curpos = emmet#util#getcurpos()
endif
let n = curpos[1]
let ml = len(matchstr(getline(n), '^\s*'))
if a:flag > 0
if a:flag == 1 || !emmet#util#regionIsValid(block)
let n = line('.')
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l < ml
let ml = l
break
endif
let n -= 1
endwhile
endif
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
else
while n > 0
let l = len(matchstr(getline(n), '^\s*\ze[a-z]'))
if l > 0 && l > ml
let ml = l
break
endif
let n += 1
endwhile
let sn = n
if n == 0
let ml = 0
endif
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
call setpos('.', [0, n, 1, 0])
normal! V
call setpos('.', [0, sn, 1, 0])
endif
endfunction
function! emmet#lang#slim#moveNextPrevItem(flag) abort
return emmet#lang#slim#moveNextPrev(a:flag)
endfunction
function! emmet#lang#slim#moveNextPrev(flag) abort
let pos = search('""\|\(^\s*|\s*\zs\)', a:flag ? 'Wpb' : 'Wp')
if pos == 2
startinsert!
elseif pos != 0
silent! normal! l
startinsert
endif
endfunction
function! emmet#lang#slim#splitJoinTag() abort
let n = line('.')
while n > 0
if getline(n) =~# '^\s*\ze[a-z]'
let sn = n
let n += 1
if getline(n) =~# '^\s*|'
while n <= line('$')
if getline(n) !~# '^\s*|'
break
endif
exe n 'delete'
endwhile
call setpos('.', [0, sn, 1, 0])
else
let spaces = matchstr(getline(sn), '^\s*')
call append(sn, spaces . ' | ')
call setpos('.', [0, sn+1, 1, 0])
startinsert!
endif
break
endif
let n -= 1
endwhile
endfunction
function! emmet#lang#slim#removeTag() abort
let n = line('.')
let ml = 0
while n > 0
if getline(n) =~# '^\s*\ze[a-z]'
let ml = len(matchstr(getline(n), '^\s*[a-z]'))
break
endif
let n -= 1
endwhile
let sn = n
while n < line('$')
let l = len(matchstr(getline(n), '^\s*[a-z]'))
if l > 0 && l <= ml
let n -= 1
break
endif
let n += 1
endwhile
if sn == n
exe 'delete'
else
exe sn ',' (n-1) 'delete'
endif
endfunction

View File

@@ -0,0 +1,65 @@
function! emmet#lorem#en#expand(command) abort
let wcount = matchstr(a:command, '\(\d*\)$')
let wcount = wcount > 0 ? wcount : 30
let common = ['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit']
let words = ['exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet',
\ 'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi',
\ 'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi',
\ 'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos',
\ 'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum',
\ 'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus',
\ 'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus',
\ 'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum',
\ 'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem',
\ 'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus',
\ 'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente',
\ 'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet',
\ 'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta',
\ 'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima',
\ 'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim',
\ 'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores',
\ 'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias',
\ 'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea',
\ 'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt',
\ 'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate',
\ 'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius',
\ 'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos',
\ 'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore',
\ 'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo',
\ 'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi',
\ 'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam',
\ 'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique',
\ 'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere',
\ 'maxime', 'corrupti']
let ret = []
let sentence = 0
for i in range(wcount)
let arr = common
if sentence > 0
let arr += words
endif
let r = emmet#util#rand()
let word = arr[r % len(arr)]
if sentence == 0
let word = substitute(word, '^.', '\U&', '')
endif
let sentence += 1
call add(ret, word)
if (sentence > 5 && emmet#util#rand() < 10000) || i == wcount - 1
if i == wcount - 1
let endc = '?!...'[emmet#util#rand() % 5]
call add(ret, endc)
else
let endc = '?!,...'[emmet#util#rand() % 6]
call add(ret, endc . ' ')
endif
if endc !=# ','
let sentence = 0
endif
else
call add(ret, ' ')
endif
endfor
return join(ret, '')
endfunction

View File

@@ -0,0 +1,27 @@
scriptencoding utf-8
function! emmet#lorem#ja#expand(command) abort
let wcount = matchstr(a:command, '^\%(lorem\|lipsum\)\(\d*\)}$', '\1', '')
let wcount = wcount > 0 ? wcount : 30
let url = "http://www.aozora.gr.jp/cards/000081/files/470_15407.html"
let content = emmet#util#cache(url)
if len(content) == 0
let content = emmet#util#getContentFromURL(url)
let content = matchstr(content, '<div[^>]*>\zs.\{-}</div>')
let content = substitute(content, '[ \r]', '', 'g')
let content = substitute(content, '<br[^>]*>', "\n", 'g')
let content = substitute(content, '<[^>]\+>', '', 'g')
let content = join(filter(split(content, "\n"), 'len(v:val)>0'), "\n")
call emmet#util#cache(url, content)
endif
let content = substitute(content, "、\n", "、", "g")
let clines = split(content, '\n')
let lines = filter(clines, 'len(substitute(v:val,".",".","g"))<=wcount')
if len(lines) == 0
let lines = clines
endif
let r = emmet#util#rand()
return lines[r % len(lines)]
endfunction

349
autoload/emmet/util.vim Normal file
View File

@@ -0,0 +1,349 @@
"==============================================================================
" region utils
"==============================================================================
" deleteContent : delete content in region
" if region make from between '<foo>' and '</foo>'
" --------------------
" begin:<foo>
" </foo>:end
" --------------------
" this function make the content as following
" --------------------
" begin::end
" --------------------
function! emmet#util#deleteContent(region) abort
let lines = getline(a:region[0][0], a:region[1][0])
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
silent! exe 'delete '.(a:region[1][0] - a:region[0][0])
call setline(line('.'), lines[0][:a:region[0][1]-2] . lines[-1][a:region[1][1]])
endfunction
" change_content : change content in region
" if region make from between '<foo>' and '</foo>'
" --------------------
" begin:<foo>
" </foo>:end
" --------------------
" and content is
" --------------------
" foo
" bar
" baz
" --------------------
" this function make the content as following
" --------------------
" begin:foo
" bar
" baz:end
" --------------------
function! emmet#util#setContent(region, content) abort
let newlines = split(a:content, '\n', 1)
let oldlines = getline(a:region[0][0], a:region[1][0])
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
silent! exe 'delete '.(a:region[1][0] - a:region[0][0])
if len(newlines) == 0
let tmp = ''
if a:region[0][1] > 1
let tmp = oldlines[0][:a:region[0][1]-2]
endif
if a:region[1][1] >= 1
let tmp .= oldlines[-1][a:region[1][1]:]
endif
call setline(line('.'), tmp)
elseif len(newlines) == 1
if a:region[0][1] > 1
let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0]
endif
if a:region[1][1] >= 1
let newlines[0] .= oldlines[-1][a:region[1][1]:]
endif
call setline(line('.'), newlines[0])
else
if a:region[0][1] > 1
let newlines[0] = oldlines[0][:a:region[0][1]-2] . newlines[0]
endif
if a:region[1][1] >= 1
let newlines[-1] .= oldlines[-1][a:region[1][1]:]
endif
call setline(line('.'), newlines[0])
call append(line('.'), newlines[1:])
endif
endfunction
" select_region : select region
" this function make a selection of region
function! emmet#util#selectRegion(region) abort
call setpos('.', [0, a:region[1][0], a:region[1][1], 0])
normal! v
call setpos('.', [0, a:region[0][0], a:region[0][1], 0])
endfunction
" point_in_region : check point is in the region
" this function return 0 or 1
function! emmet#util#pointInRegion(point, region) abort
if !emmet#util#regionIsValid(a:region) | return 0 | endif
if a:region[0][0] > a:point[0] | return 0 | endif
if a:region[1][0] < a:point[0] | return 0 | endif
if a:region[0][0] == a:point[0] && a:region[0][1] > a:point[1] | return 0 | endif
if a:region[1][0] == a:point[0] && a:region[1][1] < a:point[1] | return 0 | endif
return 1
endfunction
" cursor_in_region : check cursor is in the region
" this function return 0 or 1
function! emmet#util#cursorInRegion(region) abort
if !emmet#util#regionIsValid(a:region) | return 0 | endif
let cur = emmet#util#getcurpos()[1:2]
return emmet#util#pointInRegion(cur, a:region)
endfunction
" region_is_valid : check region is valid
" this function return 0 or 1
function! emmet#util#regionIsValid(region) abort
if a:region[0][0] == 0 || a:region[1][0] == 0 | return 0 | endif
return 1
endfunction
" search_region : make region from pattern which is composing start/end
" this function return array of position
function! emmet#util#searchRegion(start, end) abort
let b = searchpairpos(a:start, '', a:end, 'bcnW')
if b == [0, 0]
return [searchpairpos(a:start, '', a:end, 'bnW'), searchpairpos(a:start, '\%#', a:end, 'nW')]
else
return [b, searchpairpos(a:start, '', a:end. '', 'nW')]
endif
endfunction
" get_content : get content in region
" this function return string in region
function! emmet#util#getContent(region) abort
if !emmet#util#regionIsValid(a:region)
return ''
endif
let lines = getline(a:region[0][0], a:region[1][0])
if a:region[0][0] == a:region[1][0]
let lines[0] = lines[0][a:region[0][1]-1:a:region[1][1]-1]
else
let lines[0] = lines[0][a:region[0][1]-1:]
let lines[-1] = lines[-1][:a:region[1][1]-1]
endif
return join(lines, "\n")
endfunction
" region_in_region : check region is in the region
" this function return 0 or 1
function! emmet#util#regionInRegion(outer, inner) abort
if !emmet#util#regionIsValid(a:inner) || !emmet#util#regionIsValid(a:outer)
return 0
endif
return emmet#util#pointInRegion(a:inner[0], a:outer) && emmet#util#pointInRegion(a:inner[1], a:outer)
endfunction
" get_visualblock : get region of visual block
" this function return region of visual block
function! emmet#util#getVisualBlock() abort
return [[line("'<"), col("'<")], [line("'>"), col("'>")]]
endfunction
"==============================================================================
" html utils
"==============================================================================
function! emmet#util#getContentFromURL(url) abort
let res = system(printf('%s -i %s', g:emmet_curl_command, shellescape(substitute(a:url, '#.*', '', ''))))
while res =~# '^HTTP/1.\d 3' || res =~# '^HTTP/1\.\d 200 Connection established' || res =~# '^HTTP/1\.\d 100 Continue'
let pos = stridx(res, "\r\n\r\n")
if pos != -1
let res = strpart(res, pos+4)
else
let pos = stridx(res, "\n\n")
let res = strpart(res, pos+2)
endif
endwhile
let pos = stridx(res, "\r\n\r\n")
if pos != -1
let content = strpart(res, pos+4)
else
let pos = stridx(res, "\n\n")
let content = strpart(res, pos+2)
endif
let header = res[:pos-1]
let charset = matchstr(content, '<meta[^>]\+content=["''][^;"'']\+;\s*charset=\zs[^;"'']\+\ze["''][^>]*>')
if len(charset) == 0
let charset = matchstr(content, '<meta\s\+charset=["'']\?\zs[^"'']\+\ze["'']\?[^>]*>')
endif
if len(charset) == 0
let charset = matchstr(header, '\nContent-Type:.* charset=[''"]\?\zs[^''";\n]\+\ze')
endif
if len(charset) == 0
let s1 = len(split(content, '?'))
let utf8 = iconv(content, 'utf-8', &encoding)
let s2 = len(split(utf8, '?'))
return (s2 == s1 || s2 >= s1 * 2) ? utf8 : content
endif
return iconv(content, charset, &encoding)
endfunction
function! emmet#util#getTextFromHTML(buf) abort
let threshold_len = 100
let threshold_per = 0.1
let buf = a:buf
let buf = strpart(buf, stridx(buf, '</head>'))
let buf = substitute(buf, '<style[^>]*>.\{-}</style>', '', 'g')
let buf = substitute(buf, '<script[^>]*>.\{-}</script>', '', 'g')
let res = ''
let max = 0
let mx = '\(<td[^>]\{-}>\)\|\(<\/td>\)\|\(<div[^>]\{-}>\)\|\(<\/div>\)'
let m = split(buf, mx)
for str in m
let c = split(str, '<[^>]*?>')
let str = substitute(str, '<[^>]\{-}>', ' ', 'g')
let str = substitute(str, '&gt;', '>', 'g')
let str = substitute(str, '&lt;', '<', 'g')
let str = substitute(str, '&quot;', '"', 'g')
let str = substitute(str, '&apos;', '''', 'g')
let str = substitute(str, '&nbsp;', ' ', 'g')
let str = substitute(str, '&yen;', '\&#65509;', 'g')
let str = substitute(str, '&amp;', '\&', 'g')
let str = substitute(str, '^\s*\(.*\)\s*$', '\1', '')
let str = substitute(str, '\s\+', ' ', 'g')
let l = len(str)
if l > threshold_len
let per = (l+0.0) / len(c)
if max < l && per > threshold_per
let max = l
let res = str
endif
endif
endfor
let res = substitute(res, '^\s*\(.*\)\s*$', '\1', 'g')
return res
endfunction
function! emmet#util#getImageSize(fn) abort
let fn = a:fn
if emmet#util#isImageMagickInstalled()
return emmet#util#imageSizeWithImageMagick(fn)
endif
if filereadable(fn)
let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
else
if fn !~# '^\w\+://'
let path = fnamemodify(expand('%'), ':p:gs?\\?/?')
if has('win32') || has('win64') |
let path = tolower(path)
endif
for k in keys(g:emmet_docroot)
let root = fnamemodify(k, ':p:gs?\\?/?')
if has('win32') || has('win64') |
let root = tolower(root)
endif
if stridx(path, root) == 0
let v = g:emmet_docroot[k]
let fn = (len(v) == 0 ? k : v) . fn
break
endif
endfor
endif
let hex = substitute(system(g:emmet_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
endif
let [width, height] = [-1, -1]
if hex =~# '^89504e470d0a1a0a'
let width = eval('0x'.hex[32:39])
let height = eval('0x'.hex[40:47])
endif
if hex =~# '^ffd8'
let pos = 4
while pos < len(hex)
let bs = hex[pos+0:pos+3]
let pos += 4
if bs ==# 'ffc0' || bs ==# 'ffc2'
let pos += 6
let height = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])
let pos += 4
let width = eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])
break
elseif bs =~# 'ffd[9a]'
break
elseif bs =~# 'ff\(e[0-9a-e]\|fe\|db\|dd\|c4\)'
let pos += (eval('0x'.hex[pos+0:pos+1])*256 + eval('0x'.hex[pos+2:pos+3])) * 2
endif
endwhile
endif
if hex =~# '^47494638'
let width = eval('0x'.hex[14:15].hex[12:13])
let height = eval('0x'.hex[18:19].hex[16:17])
endif
return [width, height]
endfunction
function! emmet#util#imageSizeWithImageMagick(fn) abort
let img_info = system('identify -format "%wx%h" "'.a:fn.'"')
let img_size = split(substitute(img_info, '\n', '', ''), 'x')
if len(img_size) != 2
return [-1, -1]
endif
return img_size
endfunction
function! emmet#util#isImageMagickInstalled() abort
if !get(s:, 'emmet_use_identify', 1)
return 0
endif
return executable('identify')
endfunction
function! emmet#util#unique(arr) abort
let m = {}
let r = []
for i in a:arr
if !has_key(m, i)
let m[i] = 1
call add(r, i)
endif
endfor
return r
endfunction
let s:seed = localtime()
function! emmet#util#srand(seed) abort
let s:seed = a:seed
endfunction
function! emmet#util#rand() abort
let s:seed = s:seed * 214013 + 2531011
return (s:seed < 0 ? s:seed - 0x80000000 : s:seed) / 0x10000 % 0x8000
endfunction
function! emmet#util#cache(name, ...) abort
let content = get(a:000, 0, '')
let dir = expand('~/.emmet/cache')
if !isdirectory(dir)
call mkdir(dir, 'p', 0700)
endif
let file = dir . '/' . substitute(a:name, '\W', '_', 'g')
if len(content) == 0
if !filereadable(file)
return ''
endif
return join(readfile(file), "\n")
endif
call writefile(split(content, "\n"), file)
endfunction
function! emmet#util#getcurpos() abort
let pos = getpos('.')
if mode(0) ==# 'i' && pos[2] > 0
let pos[2] -=1
endif
return pos
endfunction
function! emmet#util#closePopup() abort
return pumvisible() ? "\<c-e>" : ''
endfunction

510
doc/emmet.txt Normal file
View File

@@ -0,0 +1,510 @@
*emmet.txt* Emmet for Vim
-------------------------------------------------------
Emmet: vim plugins for HTML and CSS hi-speed coding
-------------------------------------------------------
Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
WebSite: http://mattn.kaoriya.net/
Repository: http://github.com/mattn/emmet-vim
Site: http://mattn.github.com/emmet-vim
License: BSD style license
==============================================================================
CONTENTS *emmet-contents*
Introduction |emmet-introduction|
Install |emmet-install|
Tutorial |emmet-tutorial|
1. Expand Abbreviation |emmet-expandabbr|
2. Wrap with Abbreviation |emmet-wrap-with-abbreviation|
3. Balance Tag Inward |emmet-balance-tag-inward|
4. Balance Tag Outward |emmet-balance-tag-outward|
5. Go to Next Edit Point |emmet-goto-next-point| |<C-Y>n|
6. Go to Previous Edit Point |emmet-goto-previous-point|
7. Update <img> Size |emmet-update-image-size|
8. Merge Lines |emmet-merge-lines|
9. Remove Tag |emmet-remove-tag|
10. Split/Join Tag |emmet-split-join-tag|
11. Toggle Comment |emmet-toggle-comment|
12. Make anchor from URL |emmet-make-anchor-url|
13. Make quoted text from URL |emmet-quoted-text-url|
14. Code Pretty |emmet-code-pretty|
15. Lorem Ipsum |emmet-lorem-ipsum|
Customize |emmet-customize|
1. Key Mappings |emmet-customize-keymappings|
2. Indent Size |emmet-indent-size|
3. Define Tag's Behavior |emmet-define-tags-behavior|
4. Complete Tag |emmet-complete-tag|
Links |emmet-links|
ToDo |emmet-todo|
==============================================================================
INTRODUCTION *emmet-introduction* *emmet*
|Emmet| is an editor plugin for high-speed HTML, XML, XSL (or any other
structured code format) coding and editing. The core of this plugin is a
powerful abbreviation engine which allows you to expand expressions?similar to
CSS selectors?into HTML code:
>
div#page>div.logo+ul#navigation>li*5>a
<
...can be expanded into:
>
<div id="page">
<div class="logo"></div>
<ul id="navigation">
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
</ul>
</div>
<
Read more about current Emmet syntax
http://docs.emmet.io/abbreviations/
Abbreviation engine has a modular structure which allows you to expand
abbreviations into different languages. Emmet currently supports CSS,
HTML, XML/XSL and HAML, Slim languages via filters.
==============================================================================
INSTALL *emmet-install*
Install the distributed files into Vim runtime directory which is usually
~/.vim/, or $HOME/vimfiles on Windows.
If you install pathogen that provided from Tim Pope, you should extract the
file into 'bundle' directory.
==============================================================================
TUTORIAL *emmet-tutorial*
If you are seeing this file as :help, then you can't edit this file.
You should copy this section and create new buffer, paste and write as
'emmet-tutor.txt'. Formally, open the file to start tutorial.
1. Expand Abbreviation *emmet-expandabbr* *<C-Y>,*
Type abbreviation as 'div>p#foo$*3>a' and type |<C-Y>,|.
>
<div>
<p id="foo1">
<a href=""></a>
</p>
<p id="foo2">
<a href=""></a>
</p>
<p id="foo3">
<a href=""></a>
</p>
</div>
<
2. Wrap with Abbreviation *emmet-wrap-with-abbreviation* *v_<C-Y>,*
Write as below.
>
test1
test2
test3
<
Then do visual select(line wise) and type |<C-Y>,|.
If you request 'Tag:', then type 'ul>li*'.
>
<ul>
<li>test1</li>
<li>test2</li>
<li>test3</li>
</ul>
<
If you type tag as 'blockquote', then you'll see as following.
>
<blockquote>
test1
test2
test3
</blockquote>
<
3. Balance Tag Inward *emmet-balance-tag-inward* *<C-Y>d*
To select inward of ul tag, type |<C-Y>d| in insert mode.
>
<ul>
* <li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
<
If cursor is at '*', |<C-Y>d| select from begin of <ul> to end of </ul>.
If cursor is at first of <li>, it select <li class="list1"></li>.
4. Balance Tag Outward *emmet-balance-tag-outward* *<C-Y>D*
To select outward of ul tag, insert mode, type <C-Y>D in insert mode.
>
<ul>
* <li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
<
If cursor is at '*', |<C-Y>D| select from next letter of <ul> to previous
letter of </ul>.
If cursor is at first of <li>, it select <li class="list1"></li>.
5. Go to Next Edit Point *emmet-goto-next-point* *<C-Y>n*
To jump next point that need to edit, type |<C-Y>n| in insert mode.
>
* <div id="foo" class="">foo</div>
<div id="bar" class="bar"></div>
<
If cursor is at '*', |<C-Y>n| move a cursor into attribute value of div
specified id as 'foo'. And type again |<C-Y>n| move a cursor into inner of
div specified id as 'bar'.
6. Go to Previous Edit Point *emmet-goto-previous-point* *<C-Y>N*
To jump previous point that need to edit, type |<C-Y>N| in insert mode.
>
<div id="foo" class="">foo</div>
<div id="bar" class="bar"></div> *
<
If cursor is at '*', |<C-Y>N| move a cursor into div specified id as 'bar'.
And type again |<C-Y>N| move a cursor into attribute value of 'foo'.
7. Update <img> Size *emmet-update-image-size* *<C-Y>i*
To expand or update size of image, type |<C-Y>i| on img tag
>
<img src="foo.png" />
<
Type '<c-y>i' on img tag
>
<img src="foo.png" width="32" height="32" />
<
If you change image, then type it again. it will be following.
>
<img src="foo-48.png" width="32" height="48" />
<
8. Merge Lines *emmet-merge-lines*
To join multi line text like following, type |J|.
>
<ul>
<li class="list1"></li>
<li class="list2"></li>
<li class="list3"></li>
</ul>
<
If you select part of line include <li> and type |<C-Y>m|, it will be
following.
>
<ul>
<li class="list1"></li><li class="list2"></li><li class="list3"></li>
</ul>
<
9. Remove Tag *emmet-remove-tag* *<C-Y>k*
To remove tag in the block, type |<C-Y>k|.
>
<div class="foo">
<a>cursor is here</a>
</div>
<
Type |<C-Y>k| in insert mode, then
>
<div class="foo">
</div>
<
And type |<C-Y>k| in there again, then div will be removed.
10. Split/Join Tag *emmet-split-join-tag* *<C-Y>j*
To join block, type |<C-Y>j|.
>
<div class="foo">
cursor is here
</div>
<
Type |<C-Y>j| in insert mode. Then,
>
<div class="foo"/>
<
And type |<C-Y>j| in there again.
>
<div class="foo">
</div>
<
11. Toggle Comment *emmet-toggle-comment* *<C-Y>/*
Move cursor to block
>
<div>
hello world
</div>
<
Type '<c-y>/' in insert mode.
>
<!-- <div>
hello world
</div> -->
<
Type '<c-y>/' in there again.
>
<div>
hello world
</div>
<
12. Make anchor from URL *emmet-make-anchor-url* *<C-Y>a*
Move cursor to URL
>
http://www.google.com/
<
Type |<C-Y>a|
>
<a href="http://www.google.com/">Google</a>
<
13. Make quoted text from URL *emmet-quoted-text-url* *<C-Y>A*
Move cursor to URL
>
http://github.com/
<
Type |<C-Y>A|
>
<blockquote class="quote">
<a href="http://github.com/">Secure source code hosting and collaborative development - GitHub</a><br />
<p>How does it work? Get up and running in seconds by forking a project, pushing an existing repository...</p>
<cite>http://github.com/</cite>
</blockquote>
<
14. Code Pretty *emmet-code-pretty* *<C-Y>c*
Select code block, for example select following code from "int main()".
>
<p>Writing in C language</p>
int main() {
puts("hello world");
}
<
Type |<C-Y>c|
>
<span class="Type">int</span>&nbsp;main() {<br />
&nbsp;&nbsp;puts(<span class="Constant">&quot;hello world&quot;</span>);<br />
}<br />
<
15. Lorem Ipsum *emmet-lorem-ipsum*
To insert dummy text.
>
lorem
<
Type |<C-Y>,|
>
<div>Adipisicing asperiores deleniti ipsum fuga deserunt perferendis
molestiae sunt excepturi aut quo nihil! Optio accusantium corporis molestiae
deserunt ab, veritatis commodi. Eius nobis ab deserunt magni iure quo
laboriosam laboriosam.</div>
<
For japanese user, put like follow into your g:user_emmet_settings:
>
let g:user_emmet_settings = {
...
\ 'custom_expands1' : {
\ '^\%(lorem\|lipsum\)\(\d*\)$' : function('emmet#lorem#ja#expand'),
\ },
...
<
You will get japanese dummy text.
>
==============================================================================
CUSTOMIZE *emmet-customize*
1. Key Mapping *emmet-customize-keymappings*
To specify leading key for expanding or balance tag, or for all,
Add this line in your vimrc: >
>
let g:user_emmet_leader_key = '<c-y>'
<
Note that a trailing ',' must be entered, so the resultant keymap is
'<c-y>,'.
If you prefer to map for each actions, then you set each variables.
'user_emmet_expandabbr_key'
'user_emmet_expandword_key'
'user_emmet_balancetaginward_key'
'user_emmet_balancetagoutward_key'
'user_emmet_next_key'
'user_emmet_prev_key'
'user_emmet_imagesize_key'
'user_emmet_togglecomment_key'
'user_emmet_splitjointag_key'
'user_emmet_removetag_key'
'user_emmet_anchorizeurl_key'
'user_emmet_anchorizesummary_key'
Or if you want to use <plug> mappings
emmet-expand-abbr
emmet-expand-word
emmet-balance-tag-inward
emmet-balance-tag-outward
emmet-move-next
emmet-move-prev
emmet-image-size
emmet-toggle-comment
emmet-split-join-tag
emmet-remove-tag
emmet-anchorize-url
emmet-anchorize-summary
emmet-merge-lines
emmet-code-pretty
So you can make the mapping affected only for a filetype you want.
>
autocmd FileType css imap <tab> <plug>(emmet-expand-abbr)
<
2. Indent Size *emmet-indent-size*
To change indent size of html, add this code in your vimrc.
>
let g:user_emmet_settings = {
\ 'html' : {
\ 'indentation' : ' '
\ },
\}
<
If you prefer to change global indent size then add this.
>
let g:user_emmet_settings = {
\ 'indentation' : ' '
\}
<
3. Define Tag's Behavior *emmet-define-tags-behavior*
Emmet.vim can change behavior of expanding abbreviation for each
filetypes as |Dictionary|. For details, see official site of Emmet.
for example, vimmer can add following.
>
let g:user_emmet_settings = {
\ 'lang' : 'ja',
\ 'html' : {
\ 'filters' : 'html',
\ 'indentation' : ' '
\ },
\ 'perl' : {
\ 'indentation' : ' ',
\ 'aliases' : {
\ 'req' : "require '|'"
\ },
\ 'snippets' : {
\ 'use' : "use strict\nuse warnings\n\n",
\ 'w' : "warn \"${cursor}\";",
\ },
\ },
\ 'php' : {
\ 'extends' : 'html',
\ 'filters' : 'html,c',
\ },
\ 'css' : {
\ 'filters' : 'fc',
\ },
\ 'javascript' : {
\ 'snippets' : {
\ 'jq' : "\\$(function() {\n\t${cursor}${child}\n});",
\ 'jq:each' : "\\$.each(arr, function(index, item)\n\t${child}\n});",
\ 'fn' : "(function() {\n\t${cursor}\n})();",
\ 'tm' : "setTimeout(function() {\n\t${cursor}\n}, 100);",
\ },
\ },
\ 'java' : {
\ 'indentation' : ' ',
\ 'snippets' : {
\ 'main': "public static void main(String[] args) {\n\t|\n}",
\ 'println': "System.out.println(\"|\");",
\ 'class': "public class | {\n}\n",
\ },
\ },
\}
<
4. Complete Tag *emmet-complete-tag*
If you want to complete tags using |omnifunc| then add this.
>
let g:use_emmet_complete_tag = 1
<
5. Enable functions in different mode
If you want to use Emmet only in some modes, set an mode option:
let g:user_emmet_mode='n' "only enable normal mode functions, or
let g:user_emmet_mode='inv' "enable all functions, which is equal to
let g:user_emmet_mode='a' "enable all function in all mode.
6. Adding custom snippets
If you have installed the |webapi|(https://github.com/mattn/webapi-vim) for
|emmet| you can also add your own snippets using a custom "snippets.json" file.
Once you have installed the |webapi| add this line to your 'vimrc':
>
let g:user_emmet_settings = webapi#json#decode(
\ join(readfile(expand('~/.snippets_custom.json')), "\n"))
<
You can change the path to your snippets_custom.json according to your
preferences.
See http://docs.emmet.io/customization/snippets/
You can find instructions about creating your customized snippets.json file.
==============================================================================
LINKS *emmet-links*
Emmet official site:
http://emmet.io/
zen-coding official site:
http://code.google.com/p/zen-coding/
zen-coding official site:
http://code.google.com/p/zen-coding/
zencoding.vim:
http://mattn.github.com/zencoding-vim
development repository:
https://github.com/mattn/zencoding-vim
my blog posts about zencoding-vim:
http://mattn.kaoriya.net/software/vim/20100222103327.htm
http://mattn.kaoriya.net/software/vim/20100306021632.htm
Japanese blog posts about zencoding-vim:
http://d.hatena.ne.jp/idesaku/20100424/1272092255
http://d.hatena.ne.jp/griefworker/20110118/vim_zen_coding
http://d.hatena.ne.jp/sakurako_s/20110126/1295988873
http://looxu.blogspot.jp/2010/02/zencodingvimhtml.html
tutorial translated in Chinese:
http://www.zfanw.com/blog/zencoding-vim-tutorial-chinese.html
==============================================================================
TODO *emmet-todo*
* wrapping inline selected.
* more documents.
* more contributor.
* more time to improve emmet.vim.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:

275
emmet.vim.vimup Normal file
View File

@@ -0,0 +1,275 @@
script_name: Emmet.vim
script_id: '2981'
script_type: utility
script_package: emmet-vim.zip
script_version: '0.85'
required_vim_version: '7.0'
summary: vim plugins for HTML and CSS hi-speed coding.
detailed_description: |
This is vim script support expanding abbreviation like emmet.
ref: http://emmet.io/
There is a movie using emmet.vim
ref: http://mattn.github.com/emmet-vim
Source Repository.
ref: http://github.com/mattn/emmet-vim
Type abbreviation
+-------------------------------------
| html:5_
+-------------------------------------
"_" is a cursor position. and type "<c-y>," (Ctrl + y and Comma)
NOTE: Don't worry about key map. you can change it easily.
+-------------------------------------
| <!DOCTYPE HTML>
| <html lang="en">
| <head>
| <title></title>
| <meta charset="UTF-8">
| </head>
| <body>
| _
| </body>
| </html>
+-------------------------------------
Type following
+-------------------------------------
| div#foo$*2>div.bar
+-------------------------------------
And type "<c-y>,"
+-------------------------------------
|<div id="foo1">
| <div class="bar">_</div>
|</div>
|<div id="foo2">
| <div class="bar"></div>
|</div>
| _
+-------------------------------------
Tutorial:
http://github.com/mattn/emmet-vim/raw/master/TUTORIAL
How work this:
http://mattn.github.com/emmet-vim
Tips:
You can customize behavior of expanding with overriding config.
This configuration will be merged at loading plugin.
let g:user_emmet_settings = {
\ 'indentation' : ' ',
\ 'perl' : {
\ 'aliases' : {
\ 'req' : 'require '
\ },
\ 'snippets' : {
\ 'use' : "use strict\nuse warnings\n\n",
\ 'warn' : "warn \"|\";",
\ }
\ }
\}
let g:user_emmet_expandabbr_key = '<c-e>'
let g:use_emmet_complete_tag = 1
You can set language attribute in html using emmet_settings['lang'].
install_details: |
# cd ~/.vim
# unzip emmet-vim.zip
or if you install pathogen.vim:
# cd ~/.vim/bundle # or make directory
# unzip /path/to/emmet-vim.zip
if you get sources from repository:
# cd ~/.vim/bundle # or make directory
# git clone http://github.com/mattn/emmet-vim.git
versions:
- '0.85': |
This is an upgrade for Emmet.vim: lot of bug fixes.
- '0.84': |
This is an upgrade for Emmet.vim: lot of bug fixes. fix bug that interpose insert completion plugins.
- '0.83': |
This is an upgrade for Emmet.vim: lot of bug fixes.
- '0.82': |
This is an upgrade for Emmet.vim: many bug fixes.
- '0.81': |
Release of Emmet.vim: renamed from ZenCoding.vim.
- '0.80': |
This is an upgrade for ZenCoding.vim: add emmet features.
- '0.74': |
This is an upgrade for ZenCoding.vim: many bug fixes.
- '0.73': |
This is an upgrade for ZenCoding.vim: many bug fixes. and support slim format (experimental).
- '0.72': |
This is an upgrade for ZenCoding.vim:
[fix] fix finding tokens.
- '0.71': |
This is an upgrade for ZenCoding.vim:
[fix] fix finding begin of tokens.
- '0.70': |
This is an upgrade for ZenCoding.vim:
[mod] Changed behavior of expanding. "div div>a|" should keep first div element.
[add] Supported slim formatter.
- '0.60': |
This is an upgrade for ZenCoding.vim:
[fix] fixed expanding {{}}.
- '0.59': |
This is an upgrade for ZenCoding.vim:
[fix] fixed toggleComment and mny bugs.
- '0.58': |
This is an upgrade for ZenCoding.vim:
[fix] fixed 'foo+' style expandos.
- '0.57': |
This is an upgrade for ZenCoding.vim:
[fix] fixed expandos that don't work 'choose' in xsl.
- '0.56': |
This is an upgrade for ZenCoding.vim:
[fix] fixed contents parser.
- '0.55': |
uploaded again: sorry, files was old.
- '0.54': |
[add] support sass, xsd.
[fix] expanding with html tag.
uploaded again: sorry, fileformat was DOS.
- '0.53': |
[fix] gif width/height was swapped.
- '0.52': |
[fix] broken wrap expanding.
- '0.51': |
This is an upgrade for ZenCoding.vim:
[fix] wrap expanding with '&'.
[fix] expand .content to class="content".
[fix] haml expanding.
[fix] bg+ snippet
- '0.50': |
This is an upgrade for ZenCoding.vim:
[fix] fixed parsing '#{{foo}}' and '.{{bar}}'.
- '0.49': |
This is an upgrade for ZenCoding.vim:
[doc] add help manual.
- '0.48': |
This is an upgrade for ZenCoding.vim:
[fix] install mappings to global.
- '0.47': |
This is an upgrade for ZenCoding.vim:
[drastic changes] enable autoload. you should whole replace older files.
package was empty. upload again.
- '0.46': |
This is an upgrade for ZenCoding.vim:
[drastic changes] enable autoload. you should whole replace older files.
- '0.45': |
This is an upgrade for ZenCoding.vim:
fixed attribute parsing like: a[href="hello', world" rel].
- '0.44': |
This is an upgrade for ZenCoding.vim:
fixed checking whether have mapping using maparg() / hasmapto().
- '0.43': |
This is an upgrade for ZenCoding.vim:
fixed behavior for nested block. like "html:5>#page>(header#globalHeader>(hgroup>h1+h2)+(nav>ul>li*3>a)+(form>p.siteSearch>input+input[type=button]))+(#contents>(#main>(section>h2+p*5)+p.pagetop>a[href=#page])+(#sub>p+(nav>ul>li>a)))+(footer#globalFoooter>(ul>li>a)+(p.copyright>small))"
- '0.42': |
This is an upgrade for ZenCoding.vim:
fixed select/option indent.
- '0.41': |
This is an upgrade for ZenCoding.vim:
fixed default filter. when using 'e' filter, output become empty.
- '0.40': |
This is an upgrade for ZenCoding.vim:
add the pure vimscript code for 'get image size'. you can use it without perl interface just now.
change key assign of ZenCodingExpandWord from ',' to ';'. it don't effect to most users.
- '0.39': |
This is an upgrade for ZenCoding.vim: fixed problem about 'selection'. see http://github.com/mattn/zencoding-vim/issues/#issue/2
- '0.38': |
This is an upgrade for ZenCoding.vim: use v7h"_s instead of v7hs for backspace.
- '0.37': |
This is an upgrade for ZenCoding.vim: fixed problem that won't working with some 'backspace' options.
- '0.36': |
This is an upgrade for ZenCoding.vim: fixed problem that filter does not work.
- '0.35': |
This is an upgrade for ZenCoding.vim: enable zencoding for other languages. (meaning php also)
- '0.34': |
This is an upgrade for ZenCoding.vim: enable zencoding for xsl. (you should add ~/.vim/ftplugin/xslt/zencoding.vim)
- '0.33': |
This is an upgrade for ZenCoding.vim: fixed problem breaking multibyte when cursor is in a part of line. enabled zencoding for javascript in html.
- '0.32': |
This is an upgrade for ZenCoding.vim: fixed indentation. supported extends so that you can enable zencoding for php/xhtml/haml other's section 14 in http://github.com/mattn/zencoding-vim/raw/master/TUTORIAL
- '0.31': |
This is an upgrade for ZenCoding.vim: fixed indentation and $$$ problem. fixed about missing support multiple classes.
- '0.30': |
This is an upgrade for ZenCoding.vim: Fixed key assign.
- '0.29': |
This is an upgrade for ZenCoding.vim: Changed leading key to '<c-y>' from '<c-z>'.
- '0.28': |
This is an upgrade for ZenCoding.vim: supported 'Balance Tag Inward/Outward', 'Go to Next/Previous Edit Point', 'Update <img> Size', 'Remove Tag', 'Split/Join Tag', 'Toggle Comment'
- '0.27': |
This is an upgrade for ZenCoding.vim: fixed problem that can't work on the part of multibyte characters. fixed inline elements behavior.
- '0.26': |
This is an upgrade for ZenCoding.vim: The count of '(((a#foo + a#bar)*2)*3)' should be 12.
- '0.25': |
This is an upgrade for ZenCoding.vim: store undo before working. good luck about 'table>(tr>td*3)*4'.
- '0.24': |
This is an upgrade for ZenCoding.vim: fixed behavior of parsing area of visual selection.
- '0.23': |
This is an upgrade for ZenCoding.vim: pre-expand '#header>li<#content' to 'div#header>li<div#content'. support () expression.
- '0.22': |
This is an upgrade for ZenCoding.vim: expand 'ul+' to 'ul>li'. fix undo ring. support visual selection. when type trigger key on visual select, it request you leader like 'ul>li'. if you give 'ul>li*' as leader, you'll get each separate 'ul>li' tags. and when you give 'blockquote' as leader, you'll get blocked text.
- '0.21': |
This is an upgrade for ZenCoding.vim: treat xhtml as html.
- '0.20': |
This is an upgrade for ZenCoding.vim: add option use_zen_complete_tag for complete abbr.
- '0.19': |
This is an upgrade for ZenCoding.vim: fixed problem that couldn't expand 'link:css' correctly.
- '0.18': |
This is an upgrade for ZenCoding.vim: ignore duplicate key map.
- '0.17': |
This is an upgrade for ZenCoding.vim: fixed key map.
- '0.16': |
This is an upgrade for ZenCoding.vim: fixed problem 'endless loop'.
- '0.15': |
This is an upgrade for ZenCoding.vim: set default filetype to 'html'.
- '0.14': |
This is an upgrade for ZenCoding.vim: fixed tag name like 'fs:n' in 'css'.
- '0.14': |
This is an upgrade for ZenCoding.vim: indentation for each languages.
- '0.13': |
This is an upgrade for ZenCoding.vim: user key map.
- '0.12': |
This is an upgrade for ZenCoding.vim: few extensive notation.
- '0.11': |
This is an upgrade for ZenCoding.vim: fixed indent.
- '0.10': |
This is an upgrade for ZenCoding.vim: fixed behavior of '+' operator
- '0.9': |
This is an upgrade for ZenCoding.vim: fixed single line behavior
- '0.8': |
This is an upgrade for ZenCoding.vim: support 'a[href=http://www.google.com]{Google}'
- '0.7': |
This is an upgrade for ZenCoding.vim: fixed behavior in 'a+b'.
- '0.6': |
This is an upgrade for ZenCoding.vim: fixed strange behavior about '<a href="">b_</a>'.
- '0.5': |
This is an upgrade for ZenCoding.vim: recover rest part in line.
- '0.4': |
This is an upgrade for ZenCoding.vim: fixed cursor position. fixed ${lang} replacement.
- '0.3': |
This is an upgrade for ZenCoding.vim: fixed line expanding.
- '0.2': |
This is an upgrade for ZenCoding.vim: fixed problem that moving cursor with expanding.
- '0.1': |
Initial upload
# __END__
# vim: filetype=yaml

View File

@@ -1,85 +0,0 @@
<!doctype html>
<head>
<title>Emmet.vim</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="static/css/style-sites.css" type="text/css" />
<!--[if IE]>
<script type="text/javascript">
document.createElement('header');
document.createElement('section');
document.createElement('nav');
document.createElement('aside');
document.createElement('footer');
document.createElement('article');
</script>
<![endif]-->
</head>
<body>
<img id="logo" src="static/images/emmet-vim-logo.png" title="禅" alt="禅" />
<h2>vim plugins for HTML and CSS hi-speed coding.</h2>
<section id="content">
<div class="blocked-content">
<article id="whats">
<h2 class="maintitle">Whats</h2>
<p>emmet for vim</p>
</article>
</div>
<br />
<div class="blocked-content">
<article id="install">
<h2 class="maintitle">Install</h2>
<p>copy plugin/emmet.vim to plugin directory. and copy autoload/emmet.vim to autoload directory.</p>
<pre class="code">
# cp -r plugin ~/.vim/.
# cp -r autoload ~/.vim/.
</pre>
<p>if you install <a href="http://www.vim.org/scripts/script.php?script_id=2332">pathogen.vim</a>, you can make it work with only copying emmet-vim directory to bundle directory.</p>
<pre class="code">
# cp -r emmet-vim ~/.vim/bundle/.
</pre>
</article>
</div>
<br />
<div class="blocked-content">
<article id="howworkthis">
<h2 class="maintitle">How This Work</h2>
<p>below is a movie when using emmet.vim</p>
<script type="text/javascript" src="https://asciinema.org/a/4568.js" id="asciicast-4568" async></script>
</div>
<!--
<embed type="application/x-shockwave-flash" src="http://ttyshare.com/t/a474271fe4eea14f6302286d2bfabd968fb40868" width="480" height="288"/>
<embed type="application/x-shockwave-flash" src="http://ttyshare.com/t/8e83a40b6e5d6590b2832fc406114dbe348fc96f" width="480" height="288"/>
-->
</article>
</div>
<br />
<div class="blocked-content">
<article id="repo">
<h2 class="maintitle">Repository</h2>
<p>
<a href="http://github.com/mattn/emmet-vim/">http://github.com/mattn/emmet-vim/</a>
</p>
</article>
</div>
<br />
<div class="blocked-content">
<article id="license">
<h2 class="maintitle">License</h2>
<p>BSD style license.</p>
</article>
</div>
<br />
<div class="blocked-content">
<article id="author">
<h2 class="maintitle">Author</h2>
<p>Project authors:</p>
<div>
<ul>
<li><a href="http://mattn.kaoriya.net/" rel="me">Yasuhiro Matsumoto</a></li>
</ul>
</div>
</article>
</div>
<br />
</section>
</body>

166
plugin/emmet.vim Normal file
View File

@@ -0,0 +1,166 @@
"=============================================================================
" File: emmet.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 17-Dec-2014.
" Version: 0.85
" WebPage: http://github.com/mattn/emmet-vim
" Description: vim plugins for HTML and CSS hi-speed coding.
" SeeAlso: http://emmet.io/
" Usage:
"
" This is vim script support expanding abbreviation like emmet.
" ref: http://emmet.io/
"
" Type abbreviation
" +-------------------------------------
" | html:5_
" +-------------------------------------
" "_" is a cursor position. and type "<c-y>," (Ctrl+y and Comma)
" NOTE: Don't worry about key map. you can change it easily.
" +-------------------------------------
" | <!DOCTYPE HTML>
" | <html lang="en">
" | <head>
" | <title></title>
" | <meta charset="UTF-8">
" | </head>
" | <body>
" | _
" | </body>
" | </html>
" +-------------------------------------
" Type following
" +-------------------------------------
" | div#foo$*2>div.bar
" +-------------------------------------
" And type "<c-y>,"
" +-------------------------------------
" |<div id="foo1">
" | <div class="bar">_</div>
" |</div>
" |<div id="foo2">
" | <div class="bar"></div>
" |</div>
" +-------------------------------------
"
" Tips:
"
" You can customize behavior of expanding with overriding config.
" This configuration will be marged at loading plugin.
"
" let g:user_emmet_settings = {
" \ 'indentation' : ' ',
" \ 'perl' : {
" \ 'aliases' : {
" \ 'req' : 'require '
" \ },
" \ 'snippets' : {
" \ 'use' : "use strict\nuse warnings\n\n",
" \ 'warn' : "warn \"|\";",
" \ }
" \ }
" \}
"
" You can set language attribute in html using 'emmet_settings.lang'.
"
" GetLatestVimScripts: 2981 1 :AutoInstall: emmet.vim
" script type: plugin
if &compatible || v:version < 702 || (exists('g:loaded_emmet_vim') && g:loaded_emmet_vim)
finish
endif
let g:loaded_emmet_vim = 1
let s:save_cpo = &cpoptions
set cpoptions&vim
if !exists('g:emmet_html5')
let g:emmet_html5 = 1
endif
if !exists('g:emmet_docroot')
let g:emmet_docroot = {}
endif
if !exists('g:emmet_debug')
let g:emmet_debug = 0
endif
if !exists('g:emmet_curl_command')
let g:emmet_curl_command = 'curl -s -L -A Mozilla/5.0'
endif
if exists('g:user_emmet_complete_tag') && g:user_emmet_complete_tag
setlocal omnifunc=emmet#completeTag
endif
if !exists('g:user_emmet_leader_key')
let g:user_emmet_leader_key = '<c-y>'
endif
function! s:install_plugin(mode, buffer)
let buffer = a:buffer ? '<buffer>' : ''
let items = [
\ {'mode': 'i', 'var': 'user_emmet_expandabbr_key', 'key': ',', 'plug': 'emmet-expand-abbr', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#expandAbbr(0,"")<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_expandabbr_key', 'key': ',', 'plug': 'emmet-expand-abbr', 'func': ':call emmet#expandAbbr(3,"")<cr>'},
\ {'mode': 'v', 'var': 'user_emmet_expandabbr_key', 'key': ',', 'plug': 'emmet-expand-abbr', 'func': ':call emmet#expandAbbr(2,"")<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_expandword_key', 'key': ';', 'plug': 'emmet-expand-word', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#expandAbbr(1,"")<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_expandword_key', 'key': ';', 'plug': 'emmet-expand-word', 'func': ':call emmet#expandAbbr(1,"")<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_update_tag', 'key': 'u', 'plug': 'emmet-update-tag', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#updateTag()<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_update_tag', 'key': 'u', 'plug': 'emmet-update-tag', 'func': ':call emmet#updateTag()<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_balancetaginward_key', 'key': 'd', 'plug': 'emmet-balance-tag-inward', 'func': '<esc>:call emmet#balanceTag(1)<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_balancetaginward_key', 'key': 'd', 'plug': 'emmet-balance-tag-inward', 'func': ':call emmet#balanceTag(1)<cr>'},
\ {'mode': 'v', 'var': 'user_emmet_balancetaginward_key', 'key': 'd', 'plug': 'emmet-balance-tag-inward', 'func': ':call emmet#balanceTag(2)<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_balancetagoutward_key', 'key': 'D', 'plug': 'emmet-balance-tag-outword', 'func': '<esc>:call emmet#balanceTag(-1)<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_balancetagoutward_key', 'key': 'D', 'plug': 'emmet-balance-tag-outword', 'func': ':call emmet#balanceTag(-1)<cr>'},
\ {'mode': 'v', 'var': 'user_emmet_balancetagoutward_key', 'key': 'D', 'plug': 'emmet-balance-tag-outword', 'func': ':call emmet#balanceTag(-2)<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_next_key', 'key': 'n', 'plug': 'emmet-move-next', 'func': '<esc>:call emmet#moveNextPrev(0)<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_next_key', 'key': 'n', 'plug': 'emmet-move-next', 'func': ':call emmet#moveNextPrev(0)<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_prev_key', 'key': 'N', 'plug': 'emmet-move-prev', 'func': '<esc>:call emmet#moveNextPrev(1)<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_prev_key', 'key': 'N', 'plug': 'emmet-move-prev', 'func': ':call emmet#moveNextPrev(1)<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_imagesize_key', 'key': 'i', 'plug': 'emmet-image-size', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#imageSize()<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_imagesize_key', 'key': 'i', 'plug': 'emmet-image-size', 'func': ':call emmet#imageSize()<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_togglecomment_key', 'key': '/', 'plug': 'emmet-toogle-comment', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#toggleComment()<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_togglecomment_key', 'key': '/', 'plug': 'emmet-toogle-comment', 'func': ':call emmet#toggleComment()<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_splitjointag_key', 'key': 'j', 'plug': 'emmet-split-join-tag', 'func': '<esc>:call emmet#splitJoinTag()<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_splitjointag_key', 'key': 'j', 'plug': 'emmet-split-join-tag', 'func': ':call emmet#splitJoinTag()<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_removetag_key', 'key': 'k', 'plug': 'emmet-remove-tag', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#removeTag()<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_removetag_key', 'key': 'k', 'plug': 'emmet-remove-tag', 'func': ':call emmet#removeTag()<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_anchorizeurl_key', 'key': 'a', 'plug': 'emmet-anchorize-url', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#anchorizeURL(0)<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_anchorizeurl_key', 'key': 'a', 'plug': 'emmet-anchorize-url', 'func': ':call emmet#anchorizeURL(0)<cr>'},
\ {'mode': 'i', 'var': 'user_emmet_anchorizesummary_key', 'key': 'A', 'plug': 'emmet-anchorize-summary', 'func': '<c-r>=emmet#util#closePopup()<cr><c-r>=emmet#anchorizeURL(1)<cr>'},
\ {'mode': 'n', 'var': 'user_emmet_anchorizesummary_key', 'key': 'A', 'plug': 'emmet-anchorize-summary', 'func': ':call emmet#anchorizeURL(1)<cr>'},
\ {'mode': 'v', 'var': 'user_emmet_mergelines_key', 'key': 'm', 'plug': 'emmet-merge-lines', 'func': ':call emmet#mergeLines()<cr>'},
\ {'mode': 'v', 'var': 'user_emmet_codepretty_key', 'key': 'c', 'plug': 'emmet-code-pretty', 'func': ':call emmet#codePretty()<cr>'},
\]
for item in items
if a:mode !=# 'a' && stridx(a:mode, item.mode) == -1
continue
endif
exe item.mode . 'noremap '. buffer .' <plug>(' . item.plug . ') ' . item.func
if exists('g:' . item.var)
let key = eval('g:' . item.var)
else
let key = g:user_emmet_leader_key . item.key
endif
if !hasmapto('<plug>(' . item.plug . ')', item.mode) && !len(maparg(key, item.mode))
exe item.mode . 'map ' . buffer . ' <unique> ' . key . ' <plug>(' . item.plug . ')'
endif
endfor
endfunction
command! -nargs=0 EmmetInstall call <SID>install_plugin(get(g:, 'user_emmet_mode', 'a'), 1)
if get(g:, 'user_emmet_install_global', 1)
call s:install_plugin(get(g:, 'user_emmet_mode', 'a'), 0)
endif
if get(g:, 'user_emmet_install_command', 1)
command! -nargs=1 Emmet call emmet#expandAbbr(4, <q-args>)
endif
let &cpoptions = s:save_cpo
unlet s:save_cpo
" vim:set et:

View File

@@ -1,99 +0,0 @@
@charset "utf-8"
section, article, aside, hgroup, header, footer, nav, figure { display: block; }
body {
font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Meiryo, "メイリオ", " Pゴシック", Verdana, Geneva, Arial, Helvetica;
text-align: center;
}
section {
clear:both;
text-align: left;
}
article {
}
img {
border: none;
}
#content {
}
h1 {
font-family: 'Verdana', 'Arial';
padding: 0.5em; margin-top: 0; margin-bottom: 0;
}
.subtitle {
background: transparent url(../images/allow-right-orange.png) no-repeat scroll 0%;
padding-left: 26px;
line-height: 26px;
text-decoration: underline;
}
.maintitle {
background: transparent url(../images/allow-right-green.png) no-repeat scroll 0%;
padding-left: 26px;
line-height: 26px;
text-decoration: underline;
}
.blocked-content {
padding: 1em;
border: 1px dotted gray;
font-family: 'Verdana', 'Arial';
}
a{
color: #006699;
text-decoration: none;
}
a:link {
color: #006699;
text-decoration: none;
}
a:visited {
color: #006699;
text-decoration: none;
}
a:hover {
color: #006699;
text-decoration: underline;
}
li a, h3 a {
padding-left:5px;
padding-right:5px;
background-color:none;
text-decoration:none;
color: #333333;
text-shadow:1px 1px 1px #ffffff;
line-height: 25px;
}
li a:hover, li a:active, h3 a:hover, li a:active {
background-color:#334d55;
text-decoration:none;
color:#ffffff;
text-shadow:1px 1px 1px #000000;
}
pre.code {
padding: 1em;
border: 1px dotted gray;
font-family: 'Verdana', 'Arial';
color: white;
background: gray;
width: 500px;
}
#tty {
font-family: monospace;
font-size: 10pt;
line-height: 0px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

File diff suppressed because it is too large Load Diff

986
unittest.vim Normal file
View File

@@ -0,0 +1,986 @@
" {{{
let s:sfile = expand('<sfile>')
function! s:reload(d)
exe 'so' a:d.'/plugin/emmet.vim'
for f in split(globpath(a:d, 'autoload/**/*.vim'), "\n")
silent! exe 'so' f
endfor
endfunction
function! s:show_type(type)
echohl Search | echon '[' a:type "]\n" | echohl None
echo "\r"
endfunction
function! s:show_category(category)
echohl MatchParen | echon '[' a:category "]\n" | echohl None
echo "\r"
endfunction
function! s:show_pass(pass)
echohl Title | echo 'pass'.a:pass."\n" | echohl None
endfunction
function! s:show_done()
echohl IncSearch | echo 'done' | echohl None
endfunction
function! s:escape(str)
let str = a:str
let str = substitute(str, "\n", '\\n', 'g')
let str = substitute(str, "\t", '\\t', 'g')
return str
endfunction
function! s:show_title(no, title)
let title = s:escape(a:title)
let width = &columns - 23
echohl MoreMsg | echon "\rtesting #".printf('%03d', a:no)
echohl None | echon ': ' . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
endfunction
function! s:show_skip(no, title)
let title = s:escape(a:title)
let width = &columns - 23
echohl WarningMsg | echon "\rskipped #".printf('%03d', a:no)
echohl None | echon ': ' . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
echo ''
endfunction
function! s:show_ok()
echohl Title | echon "ok\n" | echohl None
echo ''
endfunction
function! s:show_ng(no, expect, got)
echohl WarningMsg | echon "ng\n" | echohl None
echohl ErrorMsg | echo 'failed test #'.a:no | echohl None
set more
echohl WarningMsg | echo printf('expect(%d):', len(a:expect)) | echohl None
echo join(split(a:expect, "\n", 1), "|\n")
echohl WarningMsg | echo printf('got(%d):', len(a:got)) | echohl None
echo join(split(a:got, "\n", 1), "|\n")
let cs = split(a:expect, '\zs')
for c in range(len(cs))
if c < len(a:got)
if a:expect[c] != a:got[c]
echohl WarningMsg | echo 'differ at:' | echohl None
echo a:expect[c :-1]
break
endif
endif
endfor
echo ''
throw 'stop'
endfunction
function! s:test(...)
let type = get(a:000, 0, '')
let name = get(a:000, 1, '')
let index = get(a:000, 2, '')
let testgroups = eval(join(filter(split(substitute(join(readfile(s:sfile), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'")))
for testgroup in testgroups
if len(type) > 0 && testgroup.type != type | continue | endif
call s:show_type(testgroup.type)
for category in testgroup.categories
if len(name) > 0 && substitute(category.name,' ','_','g') != name | continue | endif
call s:show_category(category.name)
let tests = category.tests
let start = reltime()
for n in range(len(tests))
if len(index) > 0 && n != index | continue | endif
let query = tests[n].query
let options = has_key(tests[n], 'options') ? tests[n].options : {}
let result = tests[n].result
if has_key(tests[n], 'skip') && tests[n].skip != 0
call s:show_skip(n+1, query)
continue
endif
let oldoptions = {}
for opt in keys(options)
if has_key(g:, opt)
let oldoptions[opt] = get(g:, opt)
endif
let g:[opt] = options[opt]
endfor
if stridx(query, '$$$$') != -1
silent! 1new
silent! exe 'setlocal ft='.testgroup.type
silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$')
if len(key) > 0
exe printf('let key = "%s"', key)
else
let key = "\<c-y>,"
endif
silent! let query = substitute(query, '\$\$\$\$.*\$\$\$\$', '$$$$', '')
silent! call setline(1, split(query, "\n"))
let cmd = "normal gg0/\\$\\$\\$\\$\ri\<del>\<del>\<del>\<del>".key
if stridx(result, '$$$$') != -1
let cmd .= '$$$$'
endif
silent! exe cmd
unlet! res | let res = join(getline(1, line('$')), "\n")
silent! bw!
call s:show_title(n+1, query)
else
call s:show_title(n+1, query)
unlet! res | let res = emmet#expandWord(query, testgroup.type, 0)
endif
for opt in keys(options)
if has_key(oldoptions, opt)
let g:[opt] = oldoptions[opt]
else
call remove(g:, opt)
endif
endfor
if stridx(result, '$$$$') != -1
if res ==# result
call s:show_ok()
else
call s:show_ng(n+1, result, res)
endif
else
if res ==# result
call s:show_ok()
else
call s:show_ng(n+1, result, res)
endif
endif
endfor
call s:show_pass(reltimestr(reltime(start)))
endfor
endfor
endfunction
function! s:do_tests(...)
try
if exists('g:user_emmet_settings')
let s:old_user_emmet_settings = g:user_emmet_settings
endif
let g:user_emmet_settings = {'variables': {'indentation': "\t", 'use_selection': 1}}
let oldmore = &more
call s:reload(fnamemodify(s:sfile, ':h'))
let &more = 0
call call('s:test', a:000)
call s:show_done()
catch
echohl ErrorMsg | echomsg v:exception | echohl None
finally
let &more=oldmore
if exists('s:old_user_emmet_settings')
let g:user_emmet_settings = s:old_user_emmet_settings
endif
endtry
endfunction
function! s:emmet_unittest_complete(arglead, cmdline, cmdpos)
let args = split(a:cmdline, '\s\+', 1)
let testgroups = eval(join(filter(split(substitute(join(readfile(s:sfile), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'")))
try
if len(args) == 2
return filter(map(testgroups, 'v:val.type'), 'stridx(v:val,args[1])!=-1')
elseif len(args) == 3
return map(filter(testgroups, 'v:val.type==args[1]')[0].categories, 'substitute(v:val.name," ","_","g")')
endif
catch
endtry
return []
endfunction
command! -nargs=* -complete=customlist,<SID>emmet_unittest_complete EmmetUnitTest call s:do_tests(<f-args>)
if s:sfile == expand('%:p')
EmmetUnitTest
endif
" }}}
finish
[
{ 'test-html': "{{{",
'type': "html",
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div",
'result': "<div></div>\n",
},
{
'query': "div#wrapper",
'result': "<div id=\"wrapper\"></div>\n",
},
{
'query': "div.box",
'result': "<div class=\"box\"></div>\n",
},
{
'query': "a[title=TITLE]",
'result': "<a href=\"\" title=\"TITLE\"></a>\n",
},
{
'query': "div#wrapper.box",
'result': "<div id=\"wrapper\" class=\"box\"></div>\n",
},
{
'query': "div#wrapper.box.current",
'result': "<div id=\"wrapper\" class=\"box current\"></div>\n",
},
{
'query': "div#wrapper.box.current[title=TITLE rel]",
'result': "<div id=\"wrapper\" class=\"box current\" title=\"TITLE\" rel=\"\"></div>\n",
},
{
'query': "div#main+div#sub",
'result': "<div id=\"main\"></div>\n<div id=\"sub\"></div>\n",
},
{
'query': "div#main>div#sub",
'result': "<div id=\"main\">\n\t<div id=\"sub\"></div>\n</div>\n",
},
{
'query': "html:xt>div#header>div#logo+ul#nav>li.item-$*5>a",
'result': "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\" />\n\t<title></title>\n</head>\n<body>\n\t<div id=\"header\">\n\t\t<div id=\"logo\"></div>\n\t\t<ul id=\"nav\">\n\t\t\t<li class=\"item-1\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-2\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-3\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-4\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-5\"><a href=\"\"></a></li>\n\t\t</ul>\n\t</div>\n\t\n</body>\n</html>",
},
{
'query': "ol>li*2",
'result': "<ol>\n\t<li></li>\n\t<li></li>\n</ol>\n",
},
{
'query': "a",
'result': "<a href=\"\"></a>\n",
},
{
'query': "obj",
'result': "<object data=\"\" type=\"\"></object>\n",
},
{
'query': "cc:ie6>p+blockquote#sample$.so.many.classes*2",
'result': "<!--[if lte IE 6]>\n\t<p></p>\n\t<blockquote id=\"sample1\" class=\"so many classes\"></blockquote>\n\t<blockquote id=\"sample2\" class=\"so many classes\"></blockquote>\n\t\n<![endif]-->",
},
{
'query': "html:4t>div#wrapper>div#header+div#contents+div#footer",
'result': "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">\n\t<title></title>\n</head>\n<body>\n\t<div id=\"wrapper\">\n\t\t<div id=\"header\"></div>\n\t\t<div id=\"contents\"></div>\n\t\t<div id=\"footer\"></div>\n\t</div>\n\t\n</body>\n</html>",
},
{
'query': "a[href=http://www.google.com/].foo#hoge",
'result': "<a id=\"hoge\" class=\"foo\" href=\"http://www.google.com/\"></a>\n",
},
{
'query': "a[href=http://www.google.com/]{Google}",
'result': "<a href=\"http://www.google.com/\">Google</a>\n",
},
{
'query': "{Emmet}",
'result': "Emmet",
},
{
'query': "a+b",
'result': "<a href=\"\"></a>\n<b></b>\n",
},
{
'query': "a>b>i<b",
'result': "<a href=\"\"><b><i></i></b><b></b></a>\n",
},
{
'query': "a>b>i^b",
'result': "<a href=\"\"><b><i></i></b><b></b></a>\n",
},
{
'query': "a>b>i<<b",
'result': "<a href=\"\"><b><i></i></b></a>\n<b></b>\n",
},
{
'query': "a>b>i^^b",
'result': "<a href=\"\"><b><i></i></b></a>\n<b></b>\n",
},
{
'query': "blockquote>b>i<<b",
'result': "<blockquote><b><i></i></b></blockquote>\n<b></b>\n",
},
{
'query': "blockquote>b>i^^b",
'result': "<blockquote><b><i></i></b></blockquote>\n<b></b>\n",
},
{
'query': "a[href=foo][class=bar]",
'result': "<a class=\"bar\" href=\"foo\"></a>\n",
},
{
'query': "a[a=b][b=c=d][e]{foo}*2",
'result': "<a href=\"e\" a=\"b\" b=\"c=d\">foo</a>\n<a href=\"e\" a=\"b\" b=\"c=d\">foo</a>\n",
},
{
'query': "a[a=b][b=c=d][e]*2{foo}",
'result': "<a href=\"e\" a=\"b\" b=\"c=d\"></a>\n<a href=\"e\" a=\"b\" b=\"c=d\"></a>\nfoo",
},
{
'query': "a*2{foo}a",
'result': "<a href=\"\"></a>\n<a href=\"\"></a>\nfoo<a href=\"\"></a>\n",
},
{
'query': "a{foo}*2>b",
'result': "<a href=\"\">foo<b></b></a>\n<a href=\"\">foo<b></b></a>\n",
},
{
'query': "a*2{foo}>b",
'result': "<a href=\"\"></a>\n<a href=\"\"></a>\nfoo",
},
{
'query': "table>tr>td.name#foo+td*3",
'result': "<table>\n\t<tr>\n\t\t<td id=\"foo\" class=\"name\"></td>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n</table>\n",
},
{
'query': "div#header + div#footer",
'result': "<div id=\"header\"></div>\n<div id=\"footer\"></div>\n",
},
{
'query': "#header + div#footer",
'result': "<div id=\"header\"></div>\n<div id=\"footer\"></div>\n",
},
{
'query': "#header > ul > li < p{Footer}",
'result': "<div id=\"header\">\n\t<ul>\n\t\t<li></li>\n\t</ul>\n\t<p>Footer</p>\n</div>\n",
},
{
'query': "#header > ul > li ^ p{Footer}",
'result': "<div id=\"header\">\n\t<ul>\n\t\t<li></li>\n\t</ul>\n\t<p>Footer</p>\n</div>\n",
},
{
'query': "a#foo$$$*3",
'result': "<a id=\"foo001\" href=\"\"></a>\n<a id=\"foo002\" href=\"\"></a>\n<a id=\"foo003\" href=\"\"></a>\n",
},
{
'query': "ul+",
'result': "<ul>\n\t<li></li>\n</ul>\n",
},
{
'query': "table+",
'result': "<table>\n\t<tr>\n\t\t<td></td>\n\t</tr>\n</table>\n",
},
{
'query': "#header>li<#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "#header>li^#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "(#header>li)<#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "(#header>li)^#content",
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
},
{
'query': "a>b>i<<div",
'result': "<a href=\"\"><b><i></i></b></a>\n<div></div>\n",
},
{
'query': "a>b>i^^div",
'result': "<a href=\"\"><b><i></i></b></a>\n<div></div>\n",
},
{
'query': "(#header>h1)+#content+#footer",
'result': "<div id=\"header\">\n\t<h1></h1>\n</div>\n<div id=\"content\"></div>\n<div id=\"footer\"></div>\n",
},
{
'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)",
'result': "<div id=\"header\">\n\t<h1></h1>\n</div>\n<div id=\"content\">\n\t<div id=\"main\">\n\t\t<h2></h2>\n\t\t<div id=\"entry1\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry2\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry3\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry4\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry5\" class=\"section\">\n\t\t\t<h3><a href=\"\"></a></h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div id=\"utilities\"></div>\n</div>\n<div id=\"footer\">\n\t<address></address>\n</div>\n",
},
{
'query': "(div>(ul*2)*2)+(#utilities)",
'result': "<div>\n\t<ul></ul>\n\t<ul></ul>\n\t<ul></ul>\n\t<ul></ul>\n</div>\n<div id=\"utilities\"></div>\n",
},
{
'query': "table>(tr>td*3)*4",
'result': "<table>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n</table>\n",
},
{
'query': "(((a#foo+a#bar)*2)*3)",
'result': "<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n<a id=\"foo\" href=\"\"></a>\n<a id=\"bar\" href=\"\"></a>\n",
},
{
'query': "div#box$*3>h3+p*2",
'result': "<div id=\"box1\">\n\t<h3></h3>\n\t<p></p>\n\t<p></p>\n</div>\n<div id=\"box2\">\n\t<h3></h3>\n\t<p></p>\n\t<p></p>\n</div>\n<div id=\"box3\">\n\t<h3></h3>\n\t<p></p>\n\t<p></p>\n</div>\n"
},
{
'query': "div#box.foo$$$.bar$$$*3",
'result': "<div id=\"box\" class=\"foo001 bar001\"></div>\n<div id=\"box\" class=\"foo002 bar002\"></div>\n<div id=\"box\" class=\"foo003 bar003\"></div>\n",
},
{
'query': "div#box$*3>h3+p.bar*2|e",
'result': "&lt;div id=\"box1\"&gt;\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n&lt;/div&gt;\n&lt;div id=\"box2\"&gt;\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n&lt;/div&gt;\n&lt;div id=\"box3\"&gt;\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n&lt;/div&gt;\n",
},
{
'query': "div>div#page>p.title+p|c",
'result': "<div>\n\t<!-- #page -->\n\t<div id=\"page\">\n\t\t<!-- .title -->\n\t\t<p class=\"title\"></p>\n\t\t<!-- /.title -->\n\t\t<p></p>\n\t</div>\n\t<!-- /#page -->\n</div>\n",
},
{
'query': "kbd*2|s",
'result': "<kbd></kbd><kbd></kbd>",
},
{
'query': "link:css",
'result': "<link rel=\"stylesheet\" href=\"style.css\" media=\"all\">\n",
},
{
'query': "a[title=\"Hello', world\" rel]",
'result': "<a href=\"\" title=\"Hello', world\" rel=\"\"></a>\n",
},
{
'query': "div>a#foo{bar}",
'result': "<div><a id=\"foo\" href=\"\">bar</a></div>\n",
},
{
'query': ".content{Hello!}",
'result': "<div class=\"content\">Hello!</div>\n",
},
{
'query': "div.logo+(div#navigation)+(div#links)",
'result': "<div class=\"logo\"></div>\n<div id=\"navigation\"></div>\n<div id=\"links\"></div>\n",
},
{
'query': "h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text}",
'result': "<h1>header</h1>\nText<a href=\"http://link.org\">linktext</a>\nagain some text<a href=\"http://anoterlink.org\">click me!</a>\nsome final text",
},
{
'query': "a{&}+div{&&}",
'result': "<a href=\"\">&</a>\n<div>&&</div>\n",
},
{
'query': "<foo/>span$$$$\\<c-y>,$$$$",
'result': "<foo/><span></span>",
},
{
'query': "foo span$$$$\\<c-y>,$$$$",
'result': "foo <span></span>",
},
{
'query': "foo span$$$$\\<c-y>,$$$$ bar",
'result': "foo <span></span> bar",
},
{
'query': "foo $$$$\\<c-o>ve\\<c-y>,p\\<cr>$$$$bar baz",
'result': "foo <p>bar</p> baz",
},
{
'query': "foo $$$$\\<c-o>vee\\<c-y>,p\\<cr>$$$$bar baz",
'result': "foo <p>bar baz</p>",
},
{
'query': "f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$",
'result': "f <div class=\"boxes\">\n\t<article class=\"box2\">\n\t\t<header>\n\t\t\t<hgroup>\n\t\t\t\t<h2>aaa</h2>\n\t\t\t\t<h3>bbb</h3>\n\t\t\t</hgroup>\n\t\t\t<p>ccc</p>\n\t\t</header>\n\t</article>\n</div>",
},
{
'query': "div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})",
'result': "<div class=\"boxes\">\n\t<div class=\"box2\">\n\t\t<section>\n\t\t\t<h2>a</h2>\n\t\t\t<p>b</p>\n\t\t</section>\n\t</div>\n\t<div class=\"box1\">\n\t\t<section>\n\t\t\t<h2>c</h2>\n\t\t\t<p>d</p>\n\t\t\t<p>e</p>\n\t\t\t<blockquote>\n\t\t\t\t<h2>f</h2>\n\t\t\t\t<h3>g</h3>\n\t\t\t</blockquote>\n\t\t\t<p>h</p>\n\t\t</section>\n\t</div>\n</div>\n",
},
{
'query': "(div>(label+input))+div",
'result': "<div>\n\t<label for=\"\"></label>\n\t<input type=\"\">\n</div>\n<div></div>\n",
},
{
'query': "test1\ntest2\ntest3$$$$\\<esc>ggVG\\<c-y>,ul>li>span*>a\\<cr>$$$$",
'result': "<ul>\n\t<li>\n\t\t<span><a href=\"\">test1</a></span>\n\t\t<span><a href=\"\">test2</a></span>\n\t\t<span><a href=\"\">test3</a></span>\n\t</li>\n</ul>",
},
{
'query': "test1\ntest2\ntest3$$$$\\<esc>ggVG\\<c-y>,input[type=input value=$#]*\\<cr>$$$$",
'result': "<input type=\"input\" value=\"test1\">\n<input type=\"input\" value=\"test2\">\n<input type=\"input\" value=\"test3\">",
},
{
'query': "div#id-$*5>div#id2-$",
'result': "<div id=\"id-1\">\n\t<div id=\"id2-1\"></div>\n</div>\n<div id=\"id-2\">\n\t<div id=\"id2-2\"></div>\n</div>\n<div id=\"id-3\">\n\t<div id=\"id2-3\"></div>\n</div>\n<div id=\"id-4\">\n\t<div id=\"id2-4\"></div>\n</div>\n<div id=\"id-5\">\n\t<div id=\"id2-5\"></div>\n</div>\n",
},
{
'query': ".foo>[bar=2]>.baz",
'result': "<div class=\"foo\">\n\t<div bar=\"2\">\n\t\t<div class=\"baz\"></div>\n\t</div>\n</div>\n",
},
{
'query': "{test case $ }*3",
'result': "test case 1 test case 2 test case 3 ",
},
{
'query': "{test case $${nr}}*3",
'result': "test case 1\ntest case 2\ntest case 3\n",
},
{
'query': "{test case \\$ }*3",
'result': "test case $ test case $ test case $ ",
},
{
'query': "{test case $$$ }*3",
'result': "test case 001 test case 002 test case 003 ",
},
{
'query': "a[title=$#]{foo}",
'result': "<a href=\"\" title=\"foo\">foo</a>\n",
},
{
'query': "span.item$*2>{item $}",
'result': "<span class=\"item1\">item 1</span>\n<span class=\"item2\">item 2</span>\n",
},
{
'query': "\t<div class=\"footer_nav\">\n\t\t<a href=\"#\">nav link</a>\n\t</div>$$$$\\<esc>ggVG\\<c-y>,div\\<cr>$$$$",
'result': "\t<div>\n\t\t<div class=\"footer_nav\">\n\t\t\t<a href=\"#\">nav link</a>\n\t\t</div>\n\t</div>",
},
{
'query': "<small>a$$$$</small>",
'result': "<small><a href=\"\"></a></small>",
},
],
},
{
'name': 'split join tag',
'tests': [
{
'query': "<div>\n\t<span>$$$$\\<c-y>j$$$$</span>\n</div>",
'result': "<div>\n\t<span/>\n</div>",
},
{
'query': "<div>\n\t<span$$$$\\<c-y>j$$$$/>\n</div>",
'result': "<div>\n\t<span></span>\n</div>",
},
],
},
{
'name': 'toggle comment',
'tests': [
{
'query': "<div>\n\t<span>$$$$\\<c-y>/$$$$</span>\n</div>",
'result': "<div>\n\t<!-- <span></span> -->\n</div>",
},
{
'query': "<div>\n\t<!-- <span>$$$$\\<c-y>/$$$$</span> -->\n</div>",
'result': "<div>\n\t<span></span>\n</div>",
},
],
},
{
'name': 'image size',
'tests': [
{
'query': "img[src=http://mattn.kaoriya.net/images/logo.png]$$$$\\<c-y>,\\<c-y>i$$$$",
'result': "<img src=\"http://mattn.kaoriya.net/images/logo.png\" alt=\"\" width=\"113\" height=\"113\">",
},
{
'query': "img[src=/logo.png]$$$$\\<c-y>,\\<c-y>i$$$$",
'result': "<img src=\"/logo.png\" alt=\"\">",
},
{
'query': "img[src=http://mattn.kaoriya.net/images/logo.png width=foo height=bar]$$$$\\<c-y>,\\<c-y>i$$$$",
'result': "<img src=\"http://mattn.kaoriya.net/images/logo.png\" alt=\"\" width=\"113\" height=\"113\">",
},
],
},
{
'name': 'move next prev',
'tests': [
{
'query': "foo+bar+baz[dankogai=\"\"]$$$$\\<c-y>,\\<esc>gg0\\<c-y>n\\<c-y>n\\<c-y>n\\<esc>Byw:%d _\\<cr>p$$$$",
'result': "dankogai",
},
],
},
{
'name': 'contains dash in attributes',
'tests': [
{
'query': "div[foo-bar=\"baz\"]",
'result': "<div foo-bar=\"baz\"></div>\n",
},
],
},
{
'name': 'default attributes',
'tests': [
{
'query': "p.title>a[/hoge/]",
'result': "<p class=\"title\"><a href=\"/hoge/\"></a></p>\n",
},
{
'query': "script[jquery.js]",
'result': "<script src=\"jquery.js\"></script>\n",
},
],
},
{
'name': 'multiple group',
'tests': [
{
'query': ".outer$*3>.inner$*2",
'result': "<div class=\"outer1\">\n\t<div class=\"inner1\"></div>\n\t<div class=\"inner2\"></div>\n</div>\n<div class=\"outer2\">\n\t<div class=\"inner1\"></div>\n\t<div class=\"inner2\"></div>\n</div>\n<div class=\"outer3\">\n\t<div class=\"inner1\"></div>\n\t<div class=\"inner2\"></div>\n</div>\n",
},
],
},
{
'name': 'group itemno',
'tests': [
{
'query': "dl>(dt{$}+dd)*3",
'result': "<dl>\n\t<dt>1</dt>\n\t<dd></dd>\n\t<dt>2</dt>\n\t<dd></dd>\n\t<dt>3</dt>\n\t<dd></dd>\n</dl>\n",
},
{
'query': "(div[attr=$]*3)*3",
'result': "<div attr=\"1\"></div>\n<div attr=\"2\"></div>\n<div attr=\"3\"></div>\n<div attr=\"1\"></div>\n<div attr=\"2\"></div>\n<div attr=\"3\"></div>\n<div attr=\"1\"></div>\n<div attr=\"2\"></div>\n<div attr=\"3\"></div>\n",
},
],
},
{
'name': 'update tag',
'tests': [
{
'query': "<h$$$$\\<c-y>u.global\\<cr>$$$$3></h3>",
'result': "<h3 class=\"global\"></h3>",
},
],
},
],
'dummy': "}}}"},
{ 'test-css': '{{{',
'type': 'css',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "{fs:n$$$$}",
'result': "{font-style: normal;}",
},
{
'query': "{fl:l|fc$$$$}",
'result': "{float: left;}",
},
{
'query': "{bg+$$$$}",
'result': "{background: $$$$#fff url() 0 0 no-repeat;}",
},
{
'query': "{bg+!$$$$}",
'result': "{background: $$$$#fff url() 0 0 no-repeat !important;}",
},
{
'query': "{m$$$$}",
'result': "{margin: $$$$;}",
},
{
'query': "{m0.1p$$$$}",
'result': "{margin: 0.1%;}",
},
{
'query': "{m1.0$$$$}",
'result': "{margin: 1.0em;}",
},
{
'query': "{m2$$$$}",
'result': "{margin: 2px;}",
},
{
'query': "{bdrs10$$$$}",
'result': "{border-radius: 10px;}",
},
{
'query': "{-bdrs20$$$$}",
'result': "{-webkit-border-radius: 20px;\n-moz-border-radius: 20px;\nborder-radius: 20px;}",
},
{
'query': "{lg(top,#fff,#000)$$$$}",
'result': "{background-image: -webkit-gradient(top, 0 0, 0 100, from(#fff), to(#000));\nbackground-image: -webkit-linear-gradient(#fff, #000);\nbackground-image: -moz-linear-gradient(#fff, #000);\nbackground-image: -o-linear-gradient(#fff, #000);\nbackground-image: linear-gradient(#fff, #000);\n}",
},
{
'query': "{m10-5-0$$$$}",
'result': "{margin: 10px 5px 0;}",
},
{
'query': "{m-10--5$$$$}",
'result': "{margin: -10px -5px;}",
},
{
'query': "{m10-auto$$$$}",
'result': "{margin: 10px auto;}",
},
{
'query': "{w100p$$$$}",
'result': "{width: 100%;}",
},
{
'query': "{h50e$$$$}",
'result': "{height: 50em;}",
},
{
'query': "{(bg+)+c$$$$}",
'result': "{background: $$$$#fff url() 0 0 no-repeat;\ncolor: #000;}",
},
{
'query': "{m0+bgi+bg++p0$$$$}",
'result': "{margin: 0;\nbackground-image: url($$$$);\nbackground: #fff url() 0 0 no-repeat;\npadding: 0;}",
},
{
'query': "{borle$$$$}",
'result': "{border-left: $$$$;}",
},
{
'query': "{c#dba$$$$}",
'result': "{color: rgb(221, 187, 170);}",
},
{
'query': "{c#dba.7$$$$}",
'result': "{color: rgb(221, 187, 170, 0.7);}",
},
{
'query': "{dn$$$$}",
'result': "{display: none;}",
},
],
},
],
'dummy': "}}}"},
{ 'test-haml': '{{{',
'type': 'haml',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}",
'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n",
},
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml",
'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n",
},
{
'query': "a*3|haml",
'result': "%a{ :href => \"\" }\n%a{ :href => \"\" }\n%a{ :href => \"\" }\n",
},
{
'query': ".content{Hello!}|haml",
'result': "%div.content Hello!\n",
},
{
'query': "a[title=$#]{foo}",
'result': "%a{ :href => \"\", :title => \"foo\" } foo\n",
},
],
},
{
'name': 'expand abbreviation',
'tests': [
{
'query': "%a foo\n bar$$$$\\<c-y>j$$$$",
'result': "%a ",
},
{
'query': "$$$$\\<c-y>j$$$$%a ",
'result': "%a $$$$",
},
],
},
{
'name': 'toggle comment',
'tests': [
{
'query': "%a{ :href => \"http://www.google.com\"$$$$\\<c-y>/$$$$ } hello",
'result': "-# %a{ :href => \"http://www.google.com\" } hello",
},
{
'query': "-# %a{ :href => \"http://www.google.com\"$$$$\\<c-y>/$$$$ } hello",
'result': "%a{ :href => \"http://www.google.com\" } hello",
},
],
},
],
'dummy': "}}}"},
{ 'test-slim': "{{{",
'type': 'slim',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}",
'result': "div\n p\n ul id=\"foo\"\n li class=\"bar1\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar2\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar3\" foo=\"bar\" bar=\"baz\"\n | baz\n",
},
{
'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim",
'result': "div\n p\n ul id=\"foo\"\n li class=\"bar1\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar2\" foo=\"bar\" bar=\"baz\"\n | baz\n li class=\"bar3\" foo=\"bar\" bar=\"baz\"\n | baz\n",
},
{
'query': "a*3|slim",
'result': "a href=\"\"\na href=\"\"\na href=\"\"\n",
},
{
'query': ".content{Hello!}|slim",
'result': "div class=\"content\"\n | Hello!\n",
},
{
'query': "a[title=$#]{foo}",
'result': "a href=\"\" title=\"foo\"\n | foo\n",
},
],
},
{
'name': 'split join tag',
'tests': [
{
'query': "a\n | foo$$$$\\<c-y>j$$$$",
'result': "a",
},
{
'query': "a$$$$\\<c-y>j$$$$",
'result': "a\n | $$$$",
},
],
},
{
'name': 'toggle comment',
'tests': [
{
'query': "a href=\"http://www.google.com\"$$$$\\<c-y>/$$$$\n | hello",
'result': "/a href=\"http://www.google.com\"\n | hello",
},
{
'query': "/a href=\"http://www.google.com\"$$$$\\<c-y>/$$$$\n | hello",
'result': "a href=\"http://www.google.com\"\n | hello",
},
],
},
],
'dummy': "}}}"},
{ 'test-xsl': "{{{",
'type': 'xsl',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "vari",
'result': "<xsl:variable name=\"\"></xsl:variable>\n",
},
{
'query': "ap>wp",
'result': "<xsl:apply-templates select=\"\" mode=\"\">\n\t<xsl:with-param name=\"\" select=\"\"></xsl:with-param>\n</xsl:apply-templates>\n",
},
],
},
],
'dummy': "}}}"},
{ 'test-xsd': "{{{",
'type': 'xsd',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "xsd:w3c",
'result': "<?xml version=\"1.0\"?>\n<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n\t<xsd:element name=\"\" type=\"\"/>\n</xsd:schema>\n",
},
],
},
],
'dummy': "}}}"},
{ 'test-mustache': "{{{",
'type': 'mustache',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "div#{{foo}}",
'result': "<div id=\"{{foo}}\"></div>\n",
},
{
'query': "div.{{foo}}",
'result': "<div class=\"{{foo}}\"></div>\n",
},
],
},
],
'dummy': "}}}"},
{ 'test-sass': "{{{",
'type': 'scss',
'categories': [
{
'name': 'expand abbreviation',
'tests': [
{
'query': "@i$$$$",
'result': "@import url();",
},
{
'query': "{fs:n$$$$}",
'result': "{font-style: normal;}",
},
{
'query': "{fl:l|fc$$$$}",
'result': "{float: left;}",
},
{
'query': "{bg+$$$$}",
'result': "{background: $$$$#fff url() 0 0 no-repeat;}",
},
{
'query': "{bg+!$$$$}",
'result': "{background: $$$$#fff url() 0 0 no-repeat !important;}",
},
{
'query': "{m$$$$}",
'result': "{margin: $$$$;}",
},
{
'query': "{m0.1p$$$$}",
'result': "{margin: 0.1%;}",
},
{
'query': "{m1.0$$$$}",
'result': "{margin: 1.0em;}",
},
{
'query': "{m2$$$$}",
'result': "{margin: 2px;}",
},
{
'query': "{bdrs10$$$$}",
'result': "{border-radius: 10px;}",
},
{
'query': "{-bdrs20$$$$}",
'result': "{-webkit-border-radius: 20px;\n-moz-border-radius: 20px;\nborder-radius: 20px;}",
},
{
'query': "{lg(top,#fff,#000)$$$$}",
'result': "{background-image: -webkit-gradient(top, 0 0, 0 100, from(#fff), to(#000));\nbackground-image: -webkit-linear-gradient(#fff, #000);\nbackground-image: -moz-linear-gradient(#fff, #000);\nbackground-image: -o-linear-gradient(#fff, #000);\nbackground-image: linear-gradient(#fff, #000);\n}",
},
{
'query': "{m10-5-0$$$$}",
'result': "{margin: 10px 5px 0;}",
},
{
'query': "{m-10--5$$$$}",
'result': "{margin: -10px -5px;}",
},
{
'query': "{m10-auto$$$$}",
'result': "{margin: 10px auto;}",
},
{
'query': "{w100p$$$$}",
'result': "{width: 100%;}",
},
{
'query': "{h50e$$$$}",
'result': "{height: 50em;}",
},
{
'query': "{(bg+)+c$$$$}",
'result': "{background: $$$$#fff url() 0 0 no-repeat;\ncolor: #000;}",
},
],
},
],
'dummy': "}}}"},
]
" vim:set et fdm=marker: