- 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, ''))
|
\ get(neosnippet#get_user_snippets_directory(), -1, ''))
|
||||||
|
|
||||||
if snippet_dir == ''
|
if snippet_dir == ''
|
||||||
|
call neosnippet#util#print_error('Snippet directory is not found.')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1058,7 +1059,8 @@ function! neosnippet#get_runtime_snippets_directory() "{{{
|
|||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! neosnippet#get_filetype() "{{{
|
function! neosnippet#get_filetype() "{{{
|
||||||
return exists('*neocomplcache#get_context_filetype') ?
|
return exists('*neocomplcache#get_context_filetype') ?
|
||||||
\ neocomplcache#get_context_filetype(1) : &filetype
|
\ neocomplcache#get_context_filetype(1) :
|
||||||
|
\ (&filetype == '' ? 'nothing' : &filetype)
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! s:get_sources_filetypes(filetype) "{{{
|
function! s:get_sources_filetypes(filetype) "{{{
|
||||||
return (exists('*neocomplcache#get_source_filetypes') ?
|
return (exists('*neocomplcache#get_source_filetypes') ?
|
||||||
|
@ -36,6 +36,7 @@ endfunction "}}}
|
|||||||
let s:source_user = {
|
let s:source_user = {
|
||||||
\ 'name': 'neosnippet/user',
|
\ 'name': 'neosnippet/user',
|
||||||
\ 'description' : 'neosnippet user file',
|
\ 'description' : 'neosnippet user file',
|
||||||
|
\ 'action_table' : {},
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! s:source_user.gather_candidates(args, context) "{{{
|
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())
|
\ neosnippet#get_user_snippets_directory())
|
||||||
endfunction "}}}
|
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.
|
" neosnippet source.
|
||||||
let s:source_runtime = {
|
let s:source_runtime = {
|
||||||
\ 'name': 'neosnippet/runtime',
|
\ 'name': 'neosnippet/runtime',
|
||||||
\ 'description' : 'neosnippet runtime file',
|
\ 'description' : 'neosnippet runtime file',
|
||||||
|
\ 'action_table' : {},
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! s:source_runtime.gather_candidates(args, context) "{{{
|
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())
|
\ neosnippet#get_runtime_snippets_directory())
|
||||||
endfunction "}}}
|
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) "{{{
|
function! s:get_snippet_candidates(dirs) "{{{
|
||||||
let _ = []
|
let _ = []
|
||||||
|
@ -731,6 +731,7 @@ CHANGELOG *neosnippet-changelog*
|
|||||||
2013-02-17
|
2013-02-17
|
||||||
- Improved :NeoSnippetEdit.
|
- Improved :NeoSnippetEdit.
|
||||||
- Added neosnippet/runtime and neosnippet/user sources.
|
- Added neosnippet/runtime and neosnippet/user sources.
|
||||||
|
- Added unite__new_candidate action.
|
||||||
|
|
||||||
2013-02-16
|
2013-02-16
|
||||||
- Added sh snippet.
|
- Added sh snippet.
|
||||||
|
Loading…
Reference in New Issue
Block a user