- Fixed snippets indentation.
This commit is contained in:
parent
bb74b83c7c
commit
16a651924c
@ -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: 15 Mar 2012.
|
" Last Modified: 16 Mar 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,7 +443,7 @@ function! s:load_snippets(snippet, snippets_file)"{{{
|
|||||||
let snippet_pattern.word = matchstr(line, '^\s\+\zs.*$')
|
let snippet_pattern.word = matchstr(line, '^\s\+\zs.*$')
|
||||||
else
|
else
|
||||||
let snippet_pattern.word .= "\n"
|
let snippet_pattern.word .= "\n"
|
||||||
\ . matchstr(line, '^\s\+\zs.*$')
|
\ . matchstr(line, '^\%(\t\| *\)\zs.*$')
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^$'
|
elseif line =~ '^$'
|
||||||
" Blank line.
|
" Blank line.
|
||||||
@ -607,22 +607,28 @@ function! s:indent_snippet(begin, end)"{{{
|
|||||||
let equalprg = &l:equalprg
|
let equalprg = &l:equalprg
|
||||||
setlocal equalprg=
|
setlocal equalprg=
|
||||||
|
|
||||||
|
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, a:end)
|
||||||
call cursor(line_nr, 0)
|
call cursor(line_nr, 0)
|
||||||
|
|
||||||
if &l:expandtab && getline('.') =~ '^\t\+'
|
if getline('.') =~ '^\t\+'
|
||||||
|
if &l:expandtab
|
||||||
" Expand tab.
|
" Expand tab.
|
||||||
cal setline('.', substitute(getline('.'),
|
cal setline('.', substitute(getline('.'),
|
||||||
\ '^\t\+', repeat(' ', &shiftwidth *
|
\ '^\t\+', repeat(' ', &shiftwidth *
|
||||||
\ len(matchstr(getline('.'), '^\t\+'))), ''))
|
\ len(matchstr(getline('.'), '^\t\+'))), ''))
|
||||||
|
elseif line_nr != a:begin
|
||||||
|
call setline('.', base_indent . getline('.'))
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
let pos = getpos('.')
|
|
||||||
startinsert!
|
|
||||||
silent normal! ==
|
silent normal! ==
|
||||||
call setpos('.', pos)
|
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
call setpos('.', pos)
|
||||||
|
|
||||||
let &l:equalprg = equalprg
|
let &l:equalprg = equalprg
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|
||||||
|
@ -295,6 +295,9 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet*
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
CHANGELOG *neocomplcache-snippets-complete-changelog*
|
CHANGELOG *neocomplcache-snippets-complete-changelog*
|
||||||
|
|
||||||
|
2012-03-16
|
||||||
|
- Fixed snippets indentation.
|
||||||
|
|
||||||
2012-03-15
|
2012-03-15
|
||||||
- Improved search snippet markers behavior.
|
- Improved search snippet markers behavior.
|
||||||
- Don't conceal default codes.
|
- Don't conceal default codes.
|
||||||
|
Loading…
Reference in New Issue
Block a user