recover rest part in line.

This commit is contained in:
mattn
2010-02-19 17:15:05 +09:00
parent 4a98c758a3
commit be9b9e35cd
2 changed files with 8 additions and 5 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.4 " Version: 0.5
" 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/
@@ -932,8 +932,9 @@ function! s:zen_toString(...)
endfunction endfunction
function! s:zen_expand() function! s:zen_expand()
let line = getline('.')[:col('.')] let line = getline('.')[:col('.')-1]
let part = matchstr(line, '\(\S*\)$') let part = matchstr(line, '^.*\(\S*\)$')
let rest = getline('.')[col('.'):]
let type = &ft let type = &ft
let items = s:zen_parseIntoTree(part, type)['child'] let items = s:zen_parseIntoTree(part, type)['child']
let expand = len(items) ? s:zen_toString(items[0], type) : '' let expand = len(items) ? s:zen_toString(items[0], type) : ''
@@ -948,7 +949,7 @@ function! s:zen_expand()
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)
let expand = indent . substitute(expand, "\n", "\n" . indent, 'g') let expand = indent . substitute(expand, "\n", "\n" . indent, 'g') . rest
let oldautoindent = &autoindent let oldautoindent = &autoindent
let lines = split(expand, '\n') let lines = split(expand, '\n')
call setline(line('.'), lines[0]) call setline(line('.'), lines[0])

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.4' script_version: '0.5'
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.
@@ -67,6 +67,8 @@ install_details: |
copy zencoding.vim to your plugin directory. copy zencoding.vim to your plugin directory.
versions: versions:
- '0.5': |
This is an upgrade for ZenCoding.vim: recover rest part in line.
- '0.4': | - '0.4': |
This is an upgrade for ZenCoding.vim: fixed cursor position. fixed ${lang} replacement. This is an upgrade for ZenCoding.vim: fixed cursor position. fixed ${lang} replacement.
- '0.3': | - '0.3': |