fixed cursor position. fixed ${lang} replacement.

This commit is contained in:
mattn
2010-02-19 17:02:53 +09:00
parent 23c639dc1d
commit 4a98c758a3
2 changed files with 18 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
" File: zencoding.vim " File: zencoding.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com> " Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: 19-Feb-2010. " Last Change: 19-Feb-2010.
" Version: 0.3 " Version: 0.4
" WebPage: http://github.com/mattn/zencoding-vim " WebPage: http://github.com/mattn/zencoding-vim
" Description: vim plugins for HTML and CSS hi-speed coding. " Description: vim plugins for HTML and CSS hi-speed coding.
" SeeAlso: http://code.google.com/p/zen-coding/ " SeeAlso: http://code.google.com/p/zen-coding/
@@ -18,7 +18,7 @@
" "_" is a cursor position. and type "<c-z>," " "_" is a cursor position. and type "<c-z>,"
" +------------------------------------- " +-------------------------------------
" | <!DOCTYPE HTML> " | <!DOCTYPE HTML>
" | <html lang="${langfull}"> " | <html lang="en">
" | <head> " | <head>
" | <title></title> " | <title></title>
" | <meta charset="UTF-8"> " | <meta charset="UTF-8">
@@ -35,14 +35,11 @@
" And type "<c-z>," " And type "<c-z>,"
" +------------------------------------- " +-------------------------------------
" |<div id="foo1"> " |<div id="foo1">
" | <div class="bar"> " | <div class="bar">_</div>
" | </div>
" |</div> " |</div>
" |<div id="foo2"> " |<div id="foo2">
" | <div class="bar"> " | <div class="bar"></div>
" | </div>
" |</div> " |</div>
" | _
" +------------------------------------- " +-------------------------------------
" "
" Tips: " Tips:
@@ -63,6 +60,8 @@
" \ } " \ }
" \} " \}
" "
" You can set language attribute in html using zen_settings['lang'].
"
" GetLatestVimScripts: 2981 1 :AutoInstall: zencoding.vim " GetLatestVimScripts: 2981 1 :AutoInstall: zencoding.vim
" script type: plugin " script type: plugin
@@ -74,6 +73,7 @@ let g:loaded_zencoding_vim = 1
unlet! s:zen_settings unlet! s:zen_settings
let s:zen_settings = { let s:zen_settings = {
\ 'indentation': "\t", \ 'indentation': "\t",
\ 'lang': "en",
\ 'css': { \ 'css': {
\ 'snippets': { \ 'snippets': {
\ '@i': '@import url(|);', \ '@i': '@import url(|);',
@@ -594,7 +594,7 @@ let s:zen_settings = {
\ ."<body>\n\t${child}|\n</body>\n" \ ."<body>\n\t${child}|\n</body>\n"
\ ."</html>", \ ."</html>",
\ 'html:5': "<!DOCTYPE HTML>\n" \ 'html:5': "<!DOCTYPE HTML>\n"
\ ."<html lang=\"${langfull}\">\n" \ ."<html lang=\"${lang}\">\n"
\ ."<head>\n" \ ."<head>\n"
\ ." <title></title>\n" \ ." <title></title>\n"
\ ." <meta charset=\"UTF-8\">\n" \ ." <meta charset=\"UTF-8\">\n"
@@ -944,6 +944,7 @@ function! s:zen_expand()
if expand !~ '|' if expand !~ '|'
let expand .= '|' let expand .= '|'
endif endif
let expand = substitute(expand, '${lang}', s:zen_settings['lang'], 'g')
silent! exec "normal! ".repeat("x", len(part)) silent! exec "normal! ".repeat("x", len(part))
let size = len(line) - len(part) let size = len(line) - len(part)
let indent = repeat(s:zen_settings['indentation'], size) let indent = repeat(s:zen_settings['indentation'], size)
@@ -992,7 +993,7 @@ function! s:zen_mergeConfig(lhs, rhs)
endfunction endfunction
if exists('g:user_zen_settings') if exists('g:user_zen_settings')
call s:zen_mergeConfig(s:zen_settings, g:user_zen_settings) call s:zen_mergeConfig(s:zen_settings, g:user_zen_settings)
endif endif
" test " test
"echo ZenExpand('html:xt>div#header>div#logo+ul#nav>li.item-$*5>a', '') "echo ZenExpand('html:xt>div#header>div#logo+ul#nav>li.item-$*5>a', '')

View File

@@ -2,7 +2,7 @@ script_name: ZenCoding.vim
script_id: '2981' script_id: '2981'
script_type: utility script_type: utility
script_package: zencoding.vim script_package: zencoding.vim
script_version: '0.3' script_version: '0.4'
required_vim_version: '7.0' required_vim_version: '7.0'
summary: vim plugins for HTML and CSS hi-speed coding. summary: vim plugins for HTML and CSS hi-speed coding.
@@ -18,7 +18,7 @@ detailed_description: |
"_" is a cursor position. and type "<c-z>," "_" is a cursor position. and type "<c-z>,"
+------------------------------------- +-------------------------------------
| <!DOCTYPE HTML> | <!DOCTYPE HTML>
| <html lang="${langfull}"> | <html lang="en">
| <head> | <head>
| <title></title> | <title></title>
| <meta charset="UTF-8"> | <meta charset="UTF-8">
@@ -35,12 +35,10 @@ detailed_description: |
And type "<c-z>," And type "<c-z>,"
+------------------------------------- +-------------------------------------
|<div id="foo1"> |<div id="foo1">
| <div class="bar"> | <div class="bar">_</div>
| </div>
|</div> |</div>
|<div id="foo2"> |<div id="foo2">
| <div class="bar"> | <div class="bar"></div>
| </div>
|</div> |</div>
| _ | _
+------------------------------------- +-------------------------------------
@@ -63,10 +61,14 @@ detailed_description: |
\ } \ }
\} \}
You can set language attribute in html using zen_settings['lang'].
install_details: | install_details: |
copy zencoding.vim to your plugin directory. copy zencoding.vim to your plugin directory.
versions: versions:
- '0.4': |
This is an upgrade for ZenCoding.vim: fixed cursor position. fixed ${lang} replacement.
- '0.3': | - '0.3': |
This is an upgrade for ZenCoding.vim: fixed line expanding. This is an upgrade for ZenCoding.vim: fixed line expanding.
- '0.2': | - '0.2': |