Add abort flag
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! unite#sources#neosnippet#define() "{{{
|
||||
function! unite#sources#neosnippet#define() abort "{{{
|
||||
let kind = {
|
||||
\ 'name' : 'neosnippet',
|
||||
\ 'default_action' : 'expand',
|
||||
@@ -46,14 +46,14 @@ let s:source = {
|
||||
\ 'action_table' : {},
|
||||
\ }
|
||||
|
||||
function! s:source.hooks.on_init(args, context) "{{{
|
||||
function! s:source.hooks.on_init(args, context) abort "{{{
|
||||
let a:context.source__cur_keyword_pos =
|
||||
\ s:get_keyword_pos(neosnippet#util#get_cur_text())
|
||||
let a:context.source__snippets =
|
||||
\ sort(values(neosnippet#helpers#get_completion_snippets()))
|
||||
endfunction"}}}
|
||||
|
||||
function! s:source.gather_candidates(args, context) "{{{
|
||||
function! s:source.gather_candidates(args, context) abort "{{{
|
||||
return map(copy(a:context.source__snippets), "{
|
||||
\ 'word' : v:val.word,
|
||||
\ 'abbr' : printf('%-50s %s', v:val.word, v:val.menu_abbr),
|
||||
@@ -74,7 +74,7 @@ let s:action_table = {}
|
||||
let s:action_table.expand = {
|
||||
\ 'description' : 'expand snippet',
|
||||
\ }
|
||||
function! s:action_table.expand.func(candidate) "{{{
|
||||
function! s:action_table.expand.func(candidate) abort "{{{
|
||||
let cur_text = neosnippet#util#get_cur_text()
|
||||
let cur_keyword_str = matchstr(cur_text, '\S\+$')
|
||||
let context = unite#get_context()
|
||||
@@ -88,7 +88,7 @@ let s:action_table.preview = {
|
||||
\ 'is_selectable' : 1,
|
||||
\ 'is_quit' : 0,
|
||||
\ }
|
||||
function! s:action_table.preview.func(candidates) "{{{
|
||||
function! s:action_table.preview.func(candidates) abort "{{{
|
||||
for snip in a:candidates
|
||||
echohl String
|
||||
echo snip.action__complete_word
|
||||
@@ -102,7 +102,7 @@ let s:action_table.unite__new_candidate = {
|
||||
\ 'description' : 'add new snippet',
|
||||
\ 'is_quit' : 1,
|
||||
\ }
|
||||
function! s:action_table.unite__new_candidate.func(candidate) "{{{
|
||||
function! s:action_table.unite__new_candidate.func(candidate) abort "{{{
|
||||
let trigger = unite#util#input('Please input snippet trigger: ')
|
||||
if trigger == ''
|
||||
echo 'Canceled.'
|
||||
@@ -136,7 +136,7 @@ let s:source.action_table = s:action_table
|
||||
unlet! s:action_table
|
||||
"}}}
|
||||
|
||||
function! unite#sources#neosnippet#start_complete() "{{{
|
||||
function! unite#sources#neosnippet#start_complete() abort "{{{
|
||||
if !exists(':Unite')
|
||||
call neosnippet#util#print_error(
|
||||
\ 'unite.vim is not installed.')
|
||||
@@ -149,7 +149,7 @@ function! unite#sources#neosnippet#start_complete() "{{{
|
||||
\ { 'input': neosnippet#util#get_cur_text(), 'buffer_name' : '' })
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_keyword_pos(cur_text) "{{{
|
||||
function! s:get_keyword_pos(cur_text) abort "{{{
|
||||
let cur_keyword_pos = match(a:cur_text, '\S\+$')
|
||||
if cur_keyword_pos < 0
|
||||
" Empty string.
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! unite#sources#neosnippet_file#define() "{{{
|
||||
function! unite#sources#neosnippet_file#define() abort "{{{
|
||||
return [s:source_user, s:source_runtime]
|
||||
endfunction "}}}
|
||||
|
||||
@@ -37,7 +37,7 @@ let s:action_table.neosnippet_source = {
|
||||
\ 'is_selectable' : 1,
|
||||
\ 'is_quit' : 1,
|
||||
\ }
|
||||
function! s:action_table.neosnippet_source.func(candidates) "{{{
|
||||
function! s:action_table.neosnippet_source.func(candidates) abort "{{{
|
||||
for candidate in a:candidates
|
||||
let snippet_name = candidate.action__path
|
||||
if snippet_name != ''
|
||||
@@ -52,7 +52,7 @@ let s:source_user = {
|
||||
\ 'description' : 'neosnippet user file',
|
||||
\ 'action_table' : copy(s:action_table),
|
||||
\ }
|
||||
function! s:source_user.gather_candidates(args, context) "{{{
|
||||
function! s:source_user.gather_candidates(args, context) abort "{{{
|
||||
return s:get_snippet_candidates(
|
||||
\ neosnippet#get_user_snippets_directory())
|
||||
endfunction "}}}
|
||||
@@ -62,7 +62,7 @@ let s:source_user.action_table.unite__new_candidate = {
|
||||
\ 'is_invalidate_cache' : 1,
|
||||
\ 'is_quit' : 1,
|
||||
\ }
|
||||
function! s:source_user.action_table.unite__new_candidate.func(candidate) "{{{
|
||||
function! s:source_user.action_table.unite__new_candidate.func(candidate) abort "{{{
|
||||
let filename = input(
|
||||
\ 'New snippet file name: ', neosnippet#helpers#get_filetype())
|
||||
if filename != ''
|
||||
@@ -77,7 +77,7 @@ let s:source_runtime = {
|
||||
\ 'description' : 'neosnippet runtime file',
|
||||
\ 'action_table' : copy(s:action_table),
|
||||
\ }
|
||||
function! s:source_runtime.gather_candidates(args, context) "{{{
|
||||
function! s:source_runtime.gather_candidates(args, context) abort "{{{
|
||||
return s:get_snippet_candidates(
|
||||
\ neosnippet#get_runtime_snippets_directory())
|
||||
endfunction "}}}
|
||||
@@ -87,7 +87,7 @@ let s:source_runtime.action_table.unite__new_candidate = {
|
||||
\ 'is_invalidate_cache' : 1,
|
||||
\ 'is_quit' : 1,
|
||||
\ }
|
||||
function! s:source_runtime.action_table.unite__new_candidate.func(candidate) "{{{
|
||||
function! s:source_runtime.action_table.unite__new_candidate.func(candidate) abort "{{{
|
||||
let filename = input(
|
||||
\ 'New snippet file name: ', neosnippet#helpers#get_filetype())
|
||||
if filename != ''
|
||||
@@ -96,7 +96,7 @@ function! s:source_runtime.action_table.unite__new_candidate.func(candidate) "{{
|
||||
endfunction"}}}
|
||||
|
||||
|
||||
function! s:get_snippet_candidates(dirs) "{{{
|
||||
function! s:get_snippet_candidates(dirs) abort "{{{
|
||||
let _ = []
|
||||
for directory in a:dirs
|
||||
let _ += map(split(unite#util#substitute_path_separator(
|
||||
|
||||
Reference in New Issue
Block a user