@@ -27,9 +27,9 @@ | |||
let s:save_cpo = &cpo | |||
set cpo&vim | |||
function! unite#sources#snippet#define() "{{{ | |||
function! unite#sources#neosnippet#define() "{{{ | |||
let kind = { | |||
\ 'name' : 'snippet', | |||
\ 'name' : 'neosnippet', | |||
\ 'default_action' : 'expand', | |||
\ 'action_table': {}, | |||
\ 'parents': ['jump_list', 'completion'], | |||
@@ -42,7 +42,7 @@ endfunction "}}} | |||
" neosnippet source. | |||
let s:source = { | |||
\ 'name': 'snippet', | |||
\ 'name': 'neosnippet', | |||
\ 'hooks' : {}, | |||
\ 'action_table' : {}, | |||
\ } | |||
@@ -58,8 +58,7 @@ function! s:source.gather_candidates(args, context) "{{{ | |||
return map(copy(a:context.source__snippets), "{ | |||
\ 'word' : v:val.word, | |||
\ 'abbr' : printf('%-50s %s', v:val.word, v:val.menu_abbr), | |||
\ 'kind' : 'snippet', | |||
\ 'dup' : 1, | |||
\ 'kind' : 'neosnippet', | |||
\ 'action__complete_word' : v:val.word, | |||
\ 'action__complete_pos' : a:context.source__cur_keyword_pos, | |||
\ 'action__path' : v:val.action__path, | |||
@@ -67,7 +66,7 @@ function! s:source.gather_candidates(args, context) "{{{ | |||
\ 'source__menu' : v:val.menu_abbr, | |||
\ 'source__snip' : v:val.snip, | |||
\ 'source__snip_ref' : v:val, | |||
\ "}) | |||
\ }") | |||
endfunction "}}} | |||
" Actions "{{{ | |||
@@ -138,7 +137,7 @@ let s:source.action_table = s:action_table | |||
unlet! s:action_table | |||
"}}} | |||
function! unite#sources#snippet#start_complete() "{{{ | |||
function! unite#sources#neosnippet#start_complete() "{{{ | |||
if !exists(':Unite') | |||
call neosnippet#util#print_error( | |||
\ 'unite.vim is not installed.') |
@@ -1,7 +1,7 @@ | |||
"============================================================================= | |||
" FILE: snippet_target.vim | |||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> | |||
" Last Modified: 21 Nov 2013. | |||
" Last Modified: 31 Dec 2013. | |||
" License: MIT license {{{ | |||
" Permission is hereby granted, free of charge, to any person obtaining | |||
" a copy of this software and associated documentation files (the | |||
@@ -27,7 +27,7 @@ | |||
let s:save_cpo = &cpo | |||
set cpo&vim | |||
function! unite#sources#snippet_target#define() "{{{ | |||
function! unite#sources#neosnippet_target#define() "{{{ | |||
if !exists('*unite#version') || unite#version() < 150 | |||
echoerr 'Your unite.vim is too old.' | |||
return [] | |||
@@ -37,7 +37,7 @@ function! unite#sources#snippet_target#define() "{{{ | |||
endfunction "}}} | |||
let s:source = { | |||
\ 'name': 'snippet/target', | |||
\ 'name': 'neosnippet/target', | |||
\ 'hooks' : {}, | |||
\ 'default_action' : 'select', | |||
\ 'action_table' : {}, | |||
@@ -54,20 +54,13 @@ function! s:source.hooks.on_init(args, context) "{{{ | |||
endfunction"}}} | |||
function! s:source.gather_candidates(args, context) "{{{ | |||
let list = [] | |||
for keyword in a:context.source__snippets | |||
let dict = { | |||
\ 'word' : printf('%-50s %s', keyword.word, keyword.menu_abbr), | |||
\ 'source__trigger' : keyword.word, | |||
\ 'source__menu' : keyword.menu_abbr, | |||
\ 'source__snip' : keyword.snip, | |||
return map(copy(a:context.source__snippets), "{ | |||
\ 'word' : printf('%-50s %s', v:val.word, v:val.menu_abbr), | |||
\ 'source__trigger' : v:val.word, | |||
\ 'source__menu' : v:val.menu_abbr, | |||
\ 'source__snip' : v:val.snip, | |||
\ 'source__context' : a:context, | |||
\ } | |||
call add(list, dict) | |||
endfor | |||
return list | |||
\ }") | |||
endfunction "}}} | |||
" Actions "{{{ | |||
@@ -82,11 +75,12 @@ function! s:source.action_table.select.func(candidate) "{{{ | |||
return | |||
endif | |||
call neosnippet#mappings#_expand_target_trigger(a:candidate.source__trigger) | |||
call neosnippet#mappings#_expand_target_trigger( | |||
\ a:candidate.source__trigger) | |||
endfunction"}}} | |||
"}}} | |||
function! unite#sources#snippet_target#start() "{{{ | |||
function! unite#sources#neosnippet_target#start() "{{{ | |||
if !exists(':Unite') | |||
call neosnippet#util#print_error( | |||
\ 'unite.vim is not installed.') | |||
@@ -101,8 +95,8 @@ function! unite#sources#snippet_target#start() "{{{ | |||
return '' | |||
endif | |||
return unite#start_complete(['snippet/target'], | |||
\ { 'buffer_name' : 'snippet/target' }) | |||
return unite#start_complete(['neosnippet/target'], | |||
\ { 'buffer_name' : 'neosnippet/target' }) | |||
endfunction "}}} | |||
function! s:get_keyword_pos(cur_text) "{{{ |
@@ -642,14 +642,14 @@ insert empty line in snippet end, you must insert placeholder. | |||
============================================================================== | |||
UNITE SOURCES *neosnippet-unite-sources* | |||
*neosnippet-unite-source-snippet* | |||
snippet | |||
*neosnippet-unite-source-neosnippet* | |||
neosnippet | |||
The candidates of the snippet source are neosnippet snippets. | |||
and their kind is "snippet". You can use the snippet source | |||
with the mapping |<Plug>(neosnippet_start_unite_snippet)|. | |||
But you can also execute it by ":Unite snippet". The snippet | |||
source offers an edit action you can use to edit the snippet | |||
files. | |||
But you can also execute it by ":Unite neosnippet". The | |||
snippet source offers an edit action you can use to edit the | |||
snippet files. | |||
Example: | |||
> | |||
@@ -665,7 +665,7 @@ neosnippet/runtime | |||
source actions | |||
snippet *neosnippet-unite-action-snippet* | |||
neosnippet *neosnippet-unite-action-neosnippet* | |||
expand Expand snippet (default action) | |||
edit Edit snippet | |||
preview View snippet definition | |||
@@ -1,2 +1,2 @@ | |||
" Detect syntax file. | |||
autocmd BufNewFile,BufRead *.snip,*.snippets set filetype=snippet | |||
autocmd BufNewFile,BufRead *.snip,*.snippets set filetype=neosnippet |
@@ -1,7 +1,7 @@ | |||
"============================================================================= | |||
" FILE: neosnippet.vim | |||
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> | |||
" Last Modified: 25 Dec 2013. | |||
" Last Modified: 31 Dec 2013. | |||
" License: MIT license {{{ | |||
" Permission is hereby granted, free of charge, to any person obtaining | |||
" a copy of this software and associated documentation files (the | |||
@@ -61,12 +61,12 @@ xnoremap <silent> <Plug>(neosnippet_get_selected_text) | |||
xnoremap <silent> <Plug>(neosnippet_expand_target) | |||
\ :<C-u>call neosnippet#mappings#_expand_target()<CR> | |||
xnoremap <silent><expr> <Plug>(neosnippet_start_unite_snippet_target) | |||
\ unite#sources#snippet_target#start() | |||
\ unite#sources#neosnippet_target#start() | |||
xnoremap <silent> <Plug>(neosnippet_register_oneshot_snippet) | |||
\ :<C-u>call neosnippet#mappings#_register_oneshot_snippet()<CR> | |||
inoremap <expr><silent> <Plug>(neosnippet_start_unite_snippet) | |||
\ unite#sources#snippet#start_complete() | |||
\ unite#sources#neosnippet#start_complete() | |||
"}}} | |||
augroup neosnippet "{{{ | |||