- Added neobundle#expandable_or_jumpable().

This commit is contained in:
Shougo Matsushita 2013-01-13 08:08:51 +09:00
parent ff8b0b60c9
commit bdc7f9cb5b
3 changed files with 28 additions and 17 deletions

View File

@ -65,8 +65,8 @@ imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump) smap <C-k> <Plug>(neosnippet_expand_or_jump)
" SuperTab like snippets behavior. " SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable() <Bar><bar> neosnippet#jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>" imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable() <Bar><bar> neosnippet#jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For snippet_complete marker. " For snippet_complete marker.
if has('conceal') if has('conceal')

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: neosnippet.vim " FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 07 Jan 2013. " Last Modified: 13 Jan 2013.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -79,6 +79,9 @@ function! s:doc_dict.search(cur_text) "{{{
endfunction"}}} endfunction"}}}
"}}} "}}}
function! neosnippet#expandable_or_jumpable() "{{{
return neosnippet#expandable() || neosnippet#jumpable()
endfunction"}}}
function! neosnippet#expandable() "{{{ function! neosnippet#expandable() "{{{
" Check snippet trigger. " Check snippet trigger.
return s:get_cursor_snippet( return s:get_cursor_snippet(

View File

@ -284,17 +284,12 @@ x_<Plug>(neosnippet_register_oneshot_snippet)
neosnippet#expandable() neosnippet#expandable()
*neosnippet#expandable()* *neosnippet#expandable()*
You can use this function with imap <expr>. It checks whether You can use this function with imap <expr>. It checks whether
the cursor text is a snippet trigger or a placeholder. This is the cursor text is a snippet trigger. This is is useful to
is useful to save key mappings. save key mappings.
Note: If you used to Note: If you used to
|neocomplcache#sources#snippets_complete#expandable()|, you |neocomplcache#sources#snippets_complete#expandable()|, you
must use both |neosnippet#expandable()| and must use |neosnippet#expandable_or_jumpable()|.
|neosnippet#jumpable()|.
>
imap <expr><C-l>
\ neosnippet#expandable() <Bar><bar> neosnippet#jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<C-n>"
<
*neocomplcache#sources#snippets_complete#expandable()* *neocomplcache#sources#snippets_complete#expandable()*
*neocomplcache#sources#snippets_complete#force_expandable()* *neocomplcache#sources#snippets_complete#force_expandable()*
Note: Note:
@ -305,14 +300,24 @@ neosnippet#expandable()
neosnippet#jumpable() neosnippet#jumpable()
*neosnippet#jumpable()* *neosnippet#jumpable()*
Use this function with imap <expr>. It checks if the cursor You can use this function with imap <expr>. It checks if the
text is an existing placeholder in current buffer. This is cursor text is an existing placeholder in current buffer. This
useful to save key mappings. is useful to save key mappings.
*neocomplcache#sources#snippets_complete#jumpable()* *neocomplcache#sources#snippets_complete#jumpable()*
Note: |neocomplcache#sources#snippets_complete#jumpable()| is Note: |neocomplcache#sources#snippets_complete#jumpable()| is
an obsolete name. an obsolete name.
neosnippet#expandable_or_jumpable()
*neosnippet#expandable_or_jumpable()*
You can use this function with imap <expr>. It checks whether
the cursor text is a snippet trigger or a placeholder. This is
is useful to save key mappings.
>
imap <expr><C-l>
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<C-n>"
<
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
FUNCTIONS *neosnippet-functions* FUNCTIONS *neosnippet-functions*
@ -337,10 +342,10 @@ EXAMPLES *neosnippet-examples*
xmap <C-l> <Plug>(neosnippet_start_unite_snippet_target) xmap <C-l> <Plug>(neosnippet_start_unite_snippet_target)
" SuperTab like snippets behavior. " SuperTab like snippets behavior.
"imap <expr><TAB> neosnippet#expandable() <Bar><bar> neosnippet#jumpable() ? "imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" " \ "\<Plug>(neosnippet_expand_or_jump)"
" \: pumvisible() ? "\<C-n>" : "\<TAB>" " \: pumvisible() ? "\<C-n>" : "\<TAB>"
"smap <expr><TAB> neosnippet#expandable() <Bar><bar> neosnippet#jumpable() ? "smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" " \ "\<Plug>(neosnippet_expand_or_jump)"
" \: "\<TAB>" " \: "\<TAB>"
@ -710,6 +715,9 @@ A: Please try below settings. It defines snipMate function.
============================================================================== ==============================================================================
CHANGELOG *neosnippet-changelog* CHANGELOG *neosnippet-changelog*
2013-01-13
- Added neosnippet#expandable_or_jumpable().
2013-01-07 2013-01-07
- Changed neosnippet#expandable() behavior. - Changed neosnippet#expandable() behavior.