- Fixed expand target.

This commit is contained in:
Shougo Matsushita 2012-11-06 15:28:54 +09:00
parent 15cad9454d
commit df8767752e
4 changed files with 12 additions and 7 deletions

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 05 Nov 2012.
" Last Modified: 06 Nov 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
@ -671,8 +671,8 @@ function! neosnippet#expand_target()"{{{
call neosnippet#substitute_selected_text(visualmode(),
\ base_indent)
call neosnippet#expand(neosnippet#util#get_cur_text(),
\ col('.'), trigger)
let col = col('.') < len(base_indent)+1 ? len(base_indent)+1 : col('.')
call neosnippet#expand(neosnippet#util#get_cur_text(), col, trigger)
endfunction"}}}
function! s:indent_snippet(begin, end)"{{{
if a:begin > a:end
@ -914,6 +914,7 @@ function! s:expand_target_placeholder(line, col)"{{{
let &l:foldmethod = 'manual'
endif
let col = col('.')
try
let base_indent = matchstr(cur_text, '^\s\+')
call setline(a:line, target_lines[0])
@ -926,8 +927,10 @@ function! s:expand_target_placeholder(line, col)"{{{
if next_line != ''
startinsert
let col = col('.')
else
startinsert!
let col = col('$')
endif
finally
if has('folding')
@ -938,7 +941,7 @@ function! s:expand_target_placeholder(line, col)"{{{
let neosnippet.target = ''
call neosnippet#jump(neosnippet#util#get_cur_text(), col('.'))
call neosnippet#jump(neosnippet#util#get_cur_text(), col)
endfunction"}}}
function! s:search_sync_placeholder(start, end, number)"{{{
if a:end == 0

View File

@ -60,7 +60,7 @@ alias \begin{titlepage}
\end{titlepage}
snippet verbatim
alias \begin{verbatim}
alias \begin{verbatim} verb
\begin{verbatim}
${1:TARGET}
\end{verbatim}

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippet_target.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 02 Nov 2012.
" Last Modified: 06 Nov 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
@ -97,8 +97,9 @@ function! s:source.action_table.select.func(candidate)"{{{
call cursor(0, getpos("'<")[2])
let col = col('.') < len(base_indent)+1 ? len(base_indent)+1 : col('.')
call neosnippet#expand(neosnippet#util#get_cur_text(),
\ col('.'), a:candidate.source__trigger)
\ col, a:candidate.source__trigger)
endfunction"}}}
"}}}

View File

@ -713,6 +713,7 @@ CHANGELOG *neosnippet-changelog*
2012-11-06
- Improved default tex snippets.
- Fixed expand target.
2012-11-05
- Fixed for comment string.