- Improved unite__new_candidate action.

This commit is contained in:
Shougo Matsushita 2012-10-18 12:35:04 +09:00
parent befa939da6
commit ae1c34cdfa
1 changed files with 8 additions and 2 deletions

View File

@ -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"}}}