From df8767752e6fd343a06bc96274a45e308f1ef9e6 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 6 Nov 2012 15:28:54 +0900 Subject: [PATCH] - Fixed expand target. --- autoload/neosnippet.vim | 11 +++++++---- autoload/neosnippet/snippets/tex.snip | 2 +- autoload/unite/sources/snippet_target.vim | 5 +++-- doc/neosnippet.txt | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index 9ce8b20..eed5580 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: neosnippet.vim " AUTHOR: Shougo Matsushita -" 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 diff --git a/autoload/neosnippet/snippets/tex.snip b/autoload/neosnippet/snippets/tex.snip index fe5b470..5840f07 100644 --- a/autoload/neosnippet/snippets/tex.snip +++ b/autoload/neosnippet/snippets/tex.snip @@ -60,7 +60,7 @@ alias \begin{titlepage} \end{titlepage} snippet verbatim -alias \begin{verbatim} +alias \begin{verbatim} verb \begin{verbatim} ${1:TARGET} \end{verbatim} diff --git a/autoload/unite/sources/snippet_target.vim b/autoload/unite/sources/snippet_target.vim index 07751c2..ac5ec89 100644 --- a/autoload/unite/sources/snippet_target.vim +++ b/autoload/unite/sources/snippet_target.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: snippet_target.vim " AUTHOR: Shougo Matsushita -" 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"}}} "}}} diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index b8b29cc..003161d 100644 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -713,6 +713,7 @@ CHANGELOG *neosnippet-changelog* 2012-11-06 - Improved default tex snippets. +- Fixed expand target. 2012-11-05 - Fixed for comment string.