Fix #192 target behavior

This commit is contained in:
Shougo Matsushita 2013-11-22 12:21:35 +09:00
parent 3003f6078d
commit 4d3bc928e0

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: view.vim " FILE: view.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 21 Nov 2013. " Last Modified: 22 Nov 2013.
" 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
@ -344,14 +344,8 @@ function! s:expand_placeholder(start, end, holder_cnt, line, ...) "{{{
\ matchstr(current_line, default_pattern), \ matchstr(current_line, default_pattern),
\ '\\\ze[^\\]', '', 'g') \ '\\\ze[^\\]', '', 'g')
if default =~ '^TARGET\>' && neosnippet.target != '' let is_target = (default =~ '^TARGET\>' && neosnippet.target != '')
let default = '' let default = substitute(default, '^TARGET:\?', neosnippet.target, '')
let is_target = 1
else
let is_target = 0
endif
let default = substitute(default, '^TARGET:\?', '', '')
let neosnippet.selected_text = default let neosnippet.selected_text = default
@ -385,7 +379,7 @@ function! s:expand_placeholder(start, end, holder_cnt, line, ...) "{{{
call setpos('.', pos) call setpos('.', pos)
if is_target if is_target && cnt < 0
" Expand target " Expand target
return s:expand_target_placeholder(a:line, match+1) return s:expand_target_placeholder(a:line, match+1)
endif endif