- Fixed exapnd indentation.

This commit is contained in:
Shougo Matsushita 2012-06-02 09:53:35 +09:00
parent cc5d07175c
commit 2bc321b8a5
2 changed files with 11 additions and 8 deletions

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: snippets_complete.vim " FILE: snippets_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 17 May 2012. " Last Modified: 02 Jun 2012.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -435,12 +435,12 @@ function! s:load_snippets(snippet, snippets_file)"{{{
let snippet_pattern.prev_word = matchstr(line, let snippet_pattern.prev_word = matchstr(line,
\ '^prev_word\s\+[''"]\zs.*\ze[''"]$') \ '^prev_word\s\+[''"]\zs.*\ze[''"]$')
elseif line =~ '^\s' elseif line =~ '^\s'
if snippet_pattern.word == '' if snippet_pattern.word != ''
let snippet_pattern.word = matchstr(line, '^\s\+\zs.*$')
else
let snippet_pattern.word .= "\n" let snippet_pattern.word .= "\n"
\ . matchstr(line, '^\%(\t\| *\)\zs.*$')
endif endif
let snippet_pattern.word .=
\ matchstr(line, '^\%(\t\| *\)\zs.*$')
elseif line =~ '^$' elseif line =~ '^$'
" Blank line. " Blank line.
let snippet_pattern.word .= "\n" let snippet_pattern.word .= "\n"
@ -563,9 +563,9 @@ function! neocomplcache#sources#snippets_complete#expand(cur_text, col, trigger_
let next_col = len(snippet_lines[-1]) + 1 let next_col = len(snippet_lines[-1]) + 1
let snippet_lines[-1] = snippet_lines[-1] . next_line let snippet_lines[-1] = snippet_lines[-1] . next_line
call setline(line('.'), snippet_lines[0]) call setline('.', snippet_lines[0])
if len(snippet_lines) > 1 if len(snippet_lines) > 1
call append(line('.'), snippet_lines[1:]) call append('.', snippet_lines[1:])
endif endif
call s:indent_snippet(begin_line, end_line) call s:indent_snippet(begin_line, end_line)
@ -606,7 +606,7 @@ function! s:indent_snippet(begin, end)"{{{
let pos = getpos('.') let pos = getpos('.')
let base_indent = matchstr(getline(a:begin), '^\s\+') let base_indent = matchstr(getline(a:begin), '^\s\+')
for line_nr in range(a:begin, a:end) for line_nr in range(a:begin+1, a:end)
call cursor(line_nr, 0) call cursor(line_nr, 0)
if getline('.') =~ '^\t\+' if getline('.') =~ '^\t\+'

View File

@ -300,6 +300,9 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet*
============================================================================== ==============================================================================
CHANGELOG *neocomplcache-snippets-complete-changelog* CHANGELOG *neocomplcache-snippets-complete-changelog*
2012-06-02
- Fixed exapnd indentation.
2012-05-16 2012-05-16
- Added ftdetect file. - Added ftdetect file.