From 2bc321b8a51f7ad32615daa11fba4591f8e668dd Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 2 Jun 2012 09:53:35 +0900 Subject: [PATCH] - Fixed exapnd indentation. --- .../neocomplcache/sources/snippets_complete.vim | 16 ++++++++-------- doc/neocomplcache-snippets-complete.txt | 3 +++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim index 36c60dc..b0d2622 100644 --- a/autoload/neocomplcache/sources/snippets_complete.vim +++ b/autoload/neocomplcache/sources/snippets_complete.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: snippets_complete.vim " AUTHOR: Shougo Matsushita -" Last Modified: 17 May 2012. +" Last Modified: 02 Jun 2012. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " 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, \ '^prev_word\s\+[''"]\zs.*\ze[''"]$') elseif line =~ '^\s' - if snippet_pattern.word == '' - let snippet_pattern.word = matchstr(line, '^\s\+\zs.*$') - else + if snippet_pattern.word != '' let snippet_pattern.word .= "\n" - \ . matchstr(line, '^\%(\t\| *\)\zs.*$') endif + + let snippet_pattern.word .= + \ matchstr(line, '^\%(\t\| *\)\zs.*$') elseif line =~ '^$' " Blank line. 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 snippet_lines[-1] = snippet_lines[-1] . next_line - call setline(line('.'), snippet_lines[0]) + call setline('.', snippet_lines[0]) if len(snippet_lines) > 1 - call append(line('.'), snippet_lines[1:]) + call append('.', snippet_lines[1:]) endif call s:indent_snippet(begin_line, end_line) @@ -606,7 +606,7 @@ function! s:indent_snippet(begin, end)"{{{ let pos = getpos('.') 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) if getline('.') =~ '^\t\+' diff --git a/doc/neocomplcache-snippets-complete.txt b/doc/neocomplcache-snippets-complete.txt index e1e7250..25df21f 100644 --- a/doc/neocomplcache-snippets-complete.txt +++ b/doc/neocomplcache-snippets-complete.txt @@ -300,6 +300,9 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet* ============================================================================== CHANGELOG *neocomplcache-snippets-complete-changelog* +2012-06-02 +- Fixed exapnd indentation. + 2012-05-16 - Added ftdetect file.