Vim Tips Wiki
Register
No edit summary
No edit summary
Line 68: Line 68:
 
<div class="one two"></div>
 
<div class="one two"></div>
 
</pre>
 
</pre>
at present, this module completely ignores the first class and gives
+
at present (v 0.30), this module completely ignores the first class and gives
 
<pre>
 
<pre>
 
<div class="two"></div>
 
<div class="two"></div>

Revision as of 04:17, 11 March 2010

Use this page to discuss script 2981 2981

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Comments

Nice work, but wouldn't something like this be easier?

let zen_profile='...'
let zen_abbr=extract_zen_code_from_current_line()

python import vim
python import zencoding.zen_core as zen
exec 'python zen_xtags=zen.parse_into_tree(r"""' . zen_abbr . '""", "' . &ft . '")'
exec 'python zen_string=zen_xtags.to_string("' . zen_profile . '")'
python vim.command("let zen_result='" + zen_string + "'")

" fix indentation and insert at cursor, replacing the zen_abbr
call insert_text_into_buffer(zen_result)

MM.

It require python or python interp.

mattn.


  • Not if you are on windoze and don't have python :-(
  • You can easily add abbreviations for you own language

I needed to add these to the vimrc to get it working.

let g:user_zen_expandabbr_key = '<c-e>'
let g:use_zen_complete_tag = 1

Change your laguage using

:set filetype='''css'''
:set filetype='''html'''

Love it thanks!

MikeyB

or quick way to get this working on html related template files is to modify the zen_get_filetype function (as of 0.22)

function! s:zen_get_filetype()
  if type == 'htmldjango' | let type = 'html' | endif
  if type == 'html.django_template' | let type = 'html' | endif

Great work


Does it support xml files? I can use sparkup to speedup editing xml files.

Frederick.zou


It's missing support for multiple classes. e.g. div.one.two should expand to

<div class="one two"></div>

at present (v 0.30), this module completely ignores the first class and gives

<div class="two"></div>

-DeepakG