From 20eedd2741d430400dab689f248e8d3e21c61337 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sun, 23 Sep 2012 13:45:38 +0900 Subject: [PATCH] - Fixed substitute tab character. --- .../neocomplcache/sources/snippets_complete.vim | 16 +++++++++++----- doc/neocomplcache-snippets-complete.txt | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim index 6f2b405..145b4bc 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: 06 Sep 2012. +" Last Modified: 23 Sep 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 @@ -443,10 +443,13 @@ function! s:load_snippets(snippet, snippets_file)"{{{ elseif line =~ '^\s' if snippet_pattern.word != '' let snippet_pattern.word .= "\n" + else + " Substitute Tab character. + let line = substitute(line, '^\t', '', '') endif let snippet_pattern.word .= - \ matchstr(line, '^\%(\t\| *\)\zs.*$') + \ matchstr(line, '^ *\zs.*$') elseif line =~ '^$' " Blank line. let snippet_pattern.word .= "\n" @@ -623,13 +626,16 @@ function! s:indent_snippet(begin, end)"{{{ call cursor(line_nr, 0) if getline('.') =~ '^\t\+' + " Delete head tab character. + let current_line = substitute(getline('.'), '^\t', '', '') + if &l:expandtab " Expand tab. - cal setline('.', substitute(getline('.'), + cal setline('.', substitute(current_line, \ '^\t\+', base_indent . repeat(' ', &shiftwidth * - \ len(matchstr(getline('.'), '^\t\+'))), '')) + \ len(matchstr(current_line, '^\t\+'))), '')) elseif line_nr != a:begin - call setline('.', base_indent . getline('.')) + call setline('.', base_indent . current_line) endif else silent normal! == diff --git a/doc/neocomplcache-snippets-complete.txt b/doc/neocomplcache-snippets-complete.txt index 71be302..7b52704 100644 --- a/doc/neocomplcache-snippets-complete.txt +++ b/doc/neocomplcache-snippets-complete.txt @@ -307,6 +307,9 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet* ============================================================================== CHANGELOG *neocomplcache-snippets-complete-changelog* +2012-09-23 +- Fixed substitute tab character. + 2012-09-06 - Added neocomplcache__convertable attribute.