Vim Tips Wiki
No edit summary
No edit summary
Line 1: Line 1:
 
Nice work, but wouldn't something like this be easier?
 
Nice work, but wouldn't something like this be easier?
   
<nowiki>
+
<pre>
 
let zen_profile='...'
 
let zen_profile='...'
 
let zen_abbr=extract_zen_code_from_current_line()
 
let zen_abbr=extract_zen_code_from_current_line()
Line 13: Line 13:
 
" fix indentation and insert at cursor, replacing the zen_abbr
 
" fix indentation and insert at cursor, replacing the zen_abbr
 
call insert_text_into_buffer(zen_result)
 
call insert_text_into_buffer(zen_result)
</nowiki>
+
</pre>
   
 
MM.
 
MM.

Revision as of 09:19, 19 February 2010

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=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.