diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim index 5c003e2..669853d 100644 --- a/autoload/neocomplcache/sources/snippets_complete.vim +++ b/autoload/neocomplcache/sources/snippets_complete.vim @@ -868,18 +868,6 @@ function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt)"{{{ call setline('.', substitute(getline('.'), sync_marker, sub, '')) endif endfunction"}}} -function! s:trigger(function)"{{{ - let cur_text = neocomplcache#get_cur_text(1) - - let col = col('.') - if mode() !=# 'i' - " Fix column. - let col += 2 - endif - - return printf("\:call %s(%s,%d)\", - \ a:function, string(cur_text), col) -endfunction"}}} function! s:eval_snippet(snippet_text)"{{{ let snip_word = '' let prev_match = 0 @@ -938,26 +926,40 @@ endfunction"}}} function! s:get_mirror_placeholder_marker_substitute_pattern()"{{{ return '\$\(\d\+\)' endfunction"}}} + function! s:SID_PREFIX()"{{{ return matchstr(expand(''), '\d\+_') endfunction"}}} +function! s:trigger(function)"{{{ + let cur_text = neocomplcache#get_cur_text(1) + + let col = col('.') + if mode() !=# 'i' + " Fix column. + let col += 2 + endif + + return printf("\:call %s(%s,%d)\", + \ a:function, string(cur_text), col) +endfunction"}}} + " Plugin key-mappings. -inoremap (neocomplcache_snippets_expand) +inoremap (neosnippet_expand_or_jump_impl) \ trigger(SID_PREFIX().'snippets_expand_or_jump') -snoremap (neocomplcache_snippets_expand) +snoremap (neosnippet_expand_or_jump_impl) \ trigger(SID_PREFIX().'snippets_expand_or_jump') -inoremap (neocomplcache_snippets_jump) +inoremap (neosnippet_jump_or_expand_impl) \ trigger(SID_PREFIX().'snippets_jump_or_expand') -snoremap (neocomplcache_snippets_jump) +snoremap (neosnippet_jump_or_expand_impl) \ trigger(SID_PREFIX().'snippets_jump_or_expand') -inoremap (neocomplcache_snippets_force_expand) +inoremap (neosnippet_expand_impl) \ trigger(SID_PREFIX().'snippets_force_expand') -snoremap (neocomplcache_snippets_force_expand) +snoremap (neosnippet_expand_impl) \ trigger(SID_PREFIX().'snippets_force_expand') -inoremap (neocomplcache_snippets_force_jump) +inoremap (neosnippet_jump_impl) \ trigger(SID_PREFIX().'snippets_force_jump') -snoremap (neocomplcache_snippets_force_jump) +snoremap (neosnippet_jump_impl) \ trigger(SID_PREFIX().'snippets_force_jump') let &cpo = s:save_cpo diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index 35bc60e..780993c 100644 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -320,6 +320,7 @@ CHANGELOG *neosnippet-changelog* 2012-09-27 - Ver.3 development is started. - Renamed documentation. +- Renamed keymappings. ------------------------------------------------------------------------------ ChangeLog 2.0: diff --git a/plugin/neosnippet.vim b/plugin/neosnippet.vim new file mode 100644 index 0000000..3aec4e1 --- /dev/null +++ b/plugin/neosnippet.vim @@ -0,0 +1,84 @@ +"============================================================================= +" FILE: neosnippet.vim +" AUTHOR: Shougo Matsushita +" Last Modified: 27 Sep 2012. +" License: MIT license {{{ +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be included +" in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +" }}} +"============================================================================= + +if exists('g:loaded_neosnippet') + finish +elseif v:version < 702 + echoerr 'neosnippet does not work this version of Vim "' . v:version . '".' + finish +endif + +let s:save_cpo = &cpo +set cpo&vim + +" Obsolute options check."{{{ +"}}} +" Global options definition."{{{ +"}}} + +" Plugin key-mappings."{{{ +imap (neosnippet_expand_or_jump) + \ (neosnippet_expand_or_jump_impl) +smap (neosnippet_expand_or_jump) + \ (neosnippet_expand_or_jump_impl) +imap (neosnippet_jump_or_expand) + \ (neosnippet_jump_or_expand_impl) +smap (neosnippet_jump_or_expand) + \ (neosnippet_jump_or_expand_impl) +imap (neosnippet_expand) + \ (neosnippet_expand_impl) +smap (neosnippet_expand) + \ (neosnippet_expand_impl) +imap (neosnippet_jump) + \ (neosnippet_jump_impl) +smap (neosnippet_jump) + \ (neosnippet_jump_impl) + +imap (neocomplcache_snippets_expand) + \ (neosnippet_expand_or_jump_impl) +smap (neocomplcache_snippets_expand) + \ (neosnippet_expand_or_jump_impl) +imap (neocomplcache_snippets_jump) + \ (neosnippet_jump_or_expand_impl) +smap (neocomplcache_snippets_jump) + \ (neosnippet_jump_or_expand_impl) +imap (neocomplcache_snippets_force_expand) + \ (neosnippet_expand_impl) +smap (neocomplcache_snippets_force_expand) + \ (neosnippet_expand_impl) +imap (neocomplcache_snippets_force_jump) + \ (neosnippet_jump_impl) +smap (neocomplcache_snippets_force_jump) + \ (neosnippet_jump_impl) +"}}} + +let g:loaded_neosnippet = 1 + +let &cpo = s:save_cpo +unlet s:save_cpo + +" __END__ +" vim: foldmethod=marker