- Added unite__new_candidate action.
This commit is contained in:
parent
8fa2d27f62
commit
b0d0bb1a6c
@ -212,6 +212,7 @@ function! neosnippet#edit_snippets(args) "{{{
|
||||
\ get(neosnippet#get_user_snippets_directory(), -1, ''))
|
||||
|
||||
if snippet_dir == ''
|
||||
call neosnippet#util#print_error('Snippet directory is not found.')
|
||||
return
|
||||
endif
|
||||
|
||||
@ -1058,7 +1059,8 @@ function! neosnippet#get_runtime_snippets_directory() "{{{
|
||||
endfunction"}}}
|
||||
function! neosnippet#get_filetype() "{{{
|
||||
return exists('*neocomplcache#get_context_filetype') ?
|
||||
\ neocomplcache#get_context_filetype(1) : &filetype
|
||||
\ neocomplcache#get_context_filetype(1) :
|
||||
\ (&filetype == '' ? 'nothing' : &filetype)
|
||||
endfunction"}}}
|
||||
function! s:get_sources_filetypes(filetype) "{{{
|
||||
return (exists('*neocomplcache#get_source_filetypes') ?
|
||||
|
@ -36,6 +36,7 @@ endfunction "}}}
|
||||
let s:source_user = {
|
||||
\ 'name': 'neosnippet/user',
|
||||
\ 'description' : 'neosnippet user file',
|
||||
\ 'action_table' : {},
|
||||
\ }
|
||||
|
||||
function! s:source_user.gather_candidates(args, context) "{{{
|
||||
@ -43,11 +44,25 @@ function! s:source_user.gather_candidates(args, context) "{{{
|
||||
\ neosnippet#get_user_snippets_directory())
|
||||
endfunction "}}}
|
||||
|
||||
let s:source_user.action_table.unite__new_candidate = {
|
||||
\ 'description' : 'create new user snippet',
|
||||
\ 'is_invalidate_cache' : 1,
|
||||
\ 'is_quit' : 1,
|
||||
\ }
|
||||
function! s:source_user.action_table.unite__new_candidate.func(candidate) "{{{
|
||||
let filename = input(
|
||||
\ 'New snippet file name: ', neosnippet#get_filetype())
|
||||
if filename != ''
|
||||
call neosnippet#edit_snippets(filename)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
|
||||
" neosnippet source.
|
||||
let s:source_runtime = {
|
||||
\ 'name': 'neosnippet/runtime',
|
||||
\ 'description' : 'neosnippet runtime file',
|
||||
\ 'action_table' : {},
|
||||
\ }
|
||||
|
||||
function! s:source_runtime.gather_candidates(args, context) "{{{
|
||||
@ -55,6 +70,19 @@ function! s:source_runtime.gather_candidates(args, context) "{{{
|
||||
\ neosnippet#get_runtime_snippets_directory())
|
||||
endfunction "}}}
|
||||
|
||||
let s:source_runtime.action_table.unite__new_candidate = {
|
||||
\ 'description' : 'create new runtime snippet',
|
||||
\ 'is_invalidate_cache' : 1,
|
||||
\ 'is_quit' : 1,
|
||||
\ }
|
||||
function! s:source_runtime.action_table.unite__new_candidate.func(candidate) "{{{
|
||||
let filename = input(
|
||||
\ 'New snippet file name: ', neosnippet#get_filetype())
|
||||
if filename != ''
|
||||
call neosnippet#edit_snippets('-runtime ' . filename)
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
|
||||
function! s:get_snippet_candidates(dirs) "{{{
|
||||
let _ = []
|
||||
|
@ -731,6 +731,7 @@ CHANGELOG *neosnippet-changelog*
|
||||
2013-02-17
|
||||
- Improved :NeoSnippetEdit.
|
||||
- Added neosnippet/runtime and neosnippet/user sources.
|
||||
- Added unite__new_candidate action.
|
||||
|
||||
2013-02-16
|
||||
- Added sh snippet.
|
||||
|
Loading…
Reference in New Issue
Block a user