- Fixed substitute tab character.

This commit is contained in:
Shougo Matsushita 2012-09-23 13:45:38 +09:00
parent fb026cf661
commit 20eedd2741
2 changed files with 14 additions and 5 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: 06 Sep 2012. " Last Modified: 23 Sep 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
@ -443,10 +443,13 @@ function! s:load_snippets(snippet, snippets_file)"{{{
elseif line =~ '^\s' elseif line =~ '^\s'
if snippet_pattern.word != '' if snippet_pattern.word != ''
let snippet_pattern.word .= "\n" let snippet_pattern.word .= "\n"
else
" Substitute Tab character.
let line = substitute(line, '^\t', '', '')
endif endif
let snippet_pattern.word .= let snippet_pattern.word .=
\ matchstr(line, '^\%(\t\| *\)\zs.*$') \ matchstr(line, '^ *\zs.*$')
elseif line =~ '^$' elseif line =~ '^$'
" Blank line. " Blank line.
let snippet_pattern.word .= "\n" let snippet_pattern.word .= "\n"
@ -623,13 +626,16 @@ function! s:indent_snippet(begin, end)"{{{
call cursor(line_nr, 0) call cursor(line_nr, 0)
if getline('.') =~ '^\t\+' if getline('.') =~ '^\t\+'
" Delete head tab character.
let current_line = substitute(getline('.'), '^\t', '', '')
if &l:expandtab if &l:expandtab
" Expand tab. " Expand tab.
cal setline('.', substitute(getline('.'), cal setline('.', substitute(current_line,
\ '^\t\+', base_indent . repeat(' ', &shiftwidth * \ '^\t\+', base_indent . repeat(' ', &shiftwidth *
\ len(matchstr(getline('.'), '^\t\+'))), '')) \ len(matchstr(current_line, '^\t\+'))), ''))
elseif line_nr != a:begin elseif line_nr != a:begin
call setline('.', base_indent . getline('.')) call setline('.', base_indent . current_line)
endif endif
else else
silent normal! == silent normal! ==

View File

@ -307,6 +307,9 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet*
============================================================================== ==============================================================================
CHANGELOG *neocomplcache-snippets-complete-changelog* CHANGELOG *neocomplcache-snippets-complete-changelog*
2012-09-23
- Fixed substitute tab character.
2012-09-06 2012-09-06
- Added neocomplcache__convertable attribute. - Added neocomplcache__convertable attribute.