From ae1c34cdfa31a6c8cd7a75c264b1ce891f947927 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Thu, 18 Oct 2012 12:35:04 +0900 Subject: [PATCH] - Improved unite__new_candidate action. --- autoload/unite/sources/snippet.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/unite/sources/snippet.vim b/autoload/unite/sources/snippet.vim index b716369..911f034 100644 --- a/autoload/unite/sources/snippet.vim +++ b/autoload/unite/sources/snippet.vim @@ -119,6 +119,12 @@ let s:action_table.unite__new_candidate = { \ 'is_quit' : 1, \ } function! s:action_table.unite__new_candidate.func(candidate)"{{{ + let trigger = unite#util#input('Please input snippet trigger: ') + if trigger == '' + echo 'Canceled.' + return + endif + call unite#take_action('open', a:candidate) if &filetype != 'snippet' " Open failed. @@ -130,10 +136,10 @@ function! s:action_table.unite__new_candidate.func(candidate)"{{{ call append('$', '') endif - call append('$', ['snippet ', 'abbr ', + call append('$', ['snippet ' . trigger, 'abbr ' . trigger, \ "prev_word '^'", ' ']) - call cursor(line('$') - 3, 0) + call cursor(line('$'), 0) call cursor(0, col('$')) endfunction"}}}