- Fixed expand target.
This commit is contained in:
parent
15cad9454d
commit
df8767752e
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: neosnippet.vim
|
" FILE: neosnippet.vim
|
||||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||||
" Last Modified: 05 Nov 2012.
|
" Last Modified: 06 Nov 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
|
||||||
@ -671,8 +671,8 @@ function! neosnippet#expand_target()"{{{
|
|||||||
call neosnippet#substitute_selected_text(visualmode(),
|
call neosnippet#substitute_selected_text(visualmode(),
|
||||||
\ base_indent)
|
\ base_indent)
|
||||||
|
|
||||||
call neosnippet#expand(neosnippet#util#get_cur_text(),
|
let col = col('.') < len(base_indent)+1 ? len(base_indent)+1 : col('.')
|
||||||
\ col('.'), trigger)
|
call neosnippet#expand(neosnippet#util#get_cur_text(), col, trigger)
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! s:indent_snippet(begin, end)"{{{
|
function! s:indent_snippet(begin, end)"{{{
|
||||||
if a:begin > a:end
|
if a:begin > a:end
|
||||||
@ -914,6 +914,7 @@ function! s:expand_target_placeholder(line, col)"{{{
|
|||||||
let &l:foldmethod = 'manual'
|
let &l:foldmethod = 'manual'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let col = col('.')
|
||||||
try
|
try
|
||||||
let base_indent = matchstr(cur_text, '^\s\+')
|
let base_indent = matchstr(cur_text, '^\s\+')
|
||||||
call setline(a:line, target_lines[0])
|
call setline(a:line, target_lines[0])
|
||||||
@ -926,8 +927,10 @@ function! s:expand_target_placeholder(line, col)"{{{
|
|||||||
|
|
||||||
if next_line != ''
|
if next_line != ''
|
||||||
startinsert
|
startinsert
|
||||||
|
let col = col('.')
|
||||||
else
|
else
|
||||||
startinsert!
|
startinsert!
|
||||||
|
let col = col('$')
|
||||||
endif
|
endif
|
||||||
finally
|
finally
|
||||||
if has('folding')
|
if has('folding')
|
||||||
@ -938,7 +941,7 @@ function! s:expand_target_placeholder(line, col)"{{{
|
|||||||
|
|
||||||
let neosnippet.target = ''
|
let neosnippet.target = ''
|
||||||
|
|
||||||
call neosnippet#jump(neosnippet#util#get_cur_text(), col('.'))
|
call neosnippet#jump(neosnippet#util#get_cur_text(), col)
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! s:search_sync_placeholder(start, end, number)"{{{
|
function! s:search_sync_placeholder(start, end, number)"{{{
|
||||||
if a:end == 0
|
if a:end == 0
|
||||||
|
@ -60,7 +60,7 @@ alias \begin{titlepage}
|
|||||||
\end{titlepage}
|
\end{titlepage}
|
||||||
|
|
||||||
snippet verbatim
|
snippet verbatim
|
||||||
alias \begin{verbatim}
|
alias \begin{verbatim} verb
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
${1:TARGET}
|
${1:TARGET}
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: snippet_target.vim
|
" FILE: snippet_target.vim
|
||||||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
|
||||||
" Last Modified: 02 Nov 2012.
|
" Last Modified: 06 Nov 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
|
||||||
@ -97,8 +97,9 @@ function! s:source.action_table.select.func(candidate)"{{{
|
|||||||
|
|
||||||
call cursor(0, getpos("'<")[2])
|
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(),
|
call neosnippet#expand(neosnippet#util#get_cur_text(),
|
||||||
\ col('.'), a:candidate.source__trigger)
|
\ col, a:candidate.source__trigger)
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
|
@ -713,6 +713,7 @@ CHANGELOG *neosnippet-changelog*
|
|||||||
|
|
||||||
2012-11-06
|
2012-11-06
|
||||||
- Improved default tex snippets.
|
- Improved default tex snippets.
|
||||||
|
- Fixed expand target.
|
||||||
|
|
||||||
2012-11-05
|
2012-11-05
|
||||||
- Fixed for comment string.
|
- Fixed for comment string.
|
||||||
|
Loading…
Reference in New Issue
Block a user