- Renamed keymappings.

This commit is contained in:
Shougo Matsushita 2012-09-27 21:30:33 +09:00
parent 60eb5de99c
commit a21c9ef22d
3 changed files with 107 additions and 20 deletions

View File

@ -868,18 +868,6 @@ function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt)"{{{
call setline('.', substitute(getline('.'), sync_marker, sub, '')) call setline('.', substitute(getline('.'), sync_marker, sub, ''))
endif endif
endfunction"}}} 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("\<ESC>:call %s(%s,%d)\<CR>",
\ a:function, string(cur_text), col)
endfunction"}}}
function! s:eval_snippet(snippet_text)"{{{ function! s:eval_snippet(snippet_text)"{{{
let snip_word = '' let snip_word = ''
let prev_match = 0 let prev_match = 0
@ -938,26 +926,40 @@ endfunction"}}}
function! s:get_mirror_placeholder_marker_substitute_pattern()"{{{ function! s:get_mirror_placeholder_marker_substitute_pattern()"{{{
return '\$\(\d\+\)' return '\$\(\d\+\)'
endfunction"}}} endfunction"}}}
function! s:SID_PREFIX()"{{{ function! s:SID_PREFIX()"{{{
return matchstr(expand('<sfile>'), '<SNR>\d\+_') return matchstr(expand('<sfile>'), '<SNR>\d\+_')
endfunction"}}} 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("\<ESC>:call %s(%s,%d)\<CR>",
\ a:function, string(cur_text), col)
endfunction"}}}
" Plugin key-mappings. " Plugin key-mappings.
inoremap <silent><expr> <Plug>(neocomplcache_snippets_expand) inoremap <silent><expr> <Plug>(neosnippet_expand_or_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump') \ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump')
snoremap <silent><expr> <Plug>(neocomplcache_snippets_expand) snoremap <silent><expr> <Plug>(neosnippet_expand_or_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump') \ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump')
inoremap <silent><expr> <Plug>(neocomplcache_snippets_jump) inoremap <silent><expr> <Plug>(neosnippet_jump_or_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand') \ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand')
snoremap <silent><expr> <Plug>(neocomplcache_snippets_jump) snoremap <silent><expr> <Plug>(neosnippet_jump_or_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand') \ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand')
inoremap <silent><expr> <Plug>(neocomplcache_snippets_force_expand) inoremap <silent><expr> <Plug>(neosnippet_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand') \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand')
snoremap <silent><expr> <Plug>(neocomplcache_snippets_force_expand) snoremap <silent><expr> <Plug>(neosnippet_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand') \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand')
inoremap <silent><expr> <Plug>(neocomplcache_snippets_force_jump) inoremap <silent><expr> <Plug>(neosnippet_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump') \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump')
snoremap <silent><expr> <Plug>(neocomplcache_snippets_force_jump) snoremap <silent><expr> <Plug>(neosnippet_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump') \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump')
let &cpo = s:save_cpo let &cpo = s:save_cpo

View File

@ -320,6 +320,7 @@ CHANGELOG *neosnippet-changelog*
2012-09-27 2012-09-27
- Ver.3 development is started. - Ver.3 development is started.
- Renamed documentation. - Renamed documentation.
- Renamed keymappings.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
ChangeLog 2.0: ChangeLog 2.0:

84
plugin/neosnippet.vim Normal file
View File

@ -0,0 +1,84 @@
"=============================================================================
" FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" 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 <silent> <Plug>(neosnippet_expand_or_jump)
\ <Plug>(neosnippet_expand_or_jump_impl)
smap <silent> <Plug>(neosnippet_expand_or_jump)
\ <Plug>(neosnippet_expand_or_jump_impl)
imap <silent> <Plug>(neosnippet_jump_or_expand)
\ <Plug>(neosnippet_jump_or_expand_impl)
smap <silent> <Plug>(neosnippet_jump_or_expand)
\ <Plug>(neosnippet_jump_or_expand_impl)
imap <silent> <Plug>(neosnippet_expand)
\ <Plug>(neosnippet_expand_impl)
smap <silent> <Plug>(neosnippet_expand)
\ <Plug>(neosnippet_expand_impl)
imap <silent> <Plug>(neosnippet_jump)
\ <Plug>(neosnippet_jump_impl)
smap <silent> <Plug>(neosnippet_jump)
\ <Plug>(neosnippet_jump_impl)
imap <silent> <Plug>(neocomplcache_snippets_expand)
\ <Plug>(neosnippet_expand_or_jump_impl)
smap <silent> <Plug>(neocomplcache_snippets_expand)
\ <Plug>(neosnippet_expand_or_jump_impl)
imap <silent> <Plug>(neocomplcache_snippets_jump)
\ <Plug>(neosnippet_jump_or_expand_impl)
smap <silent> <Plug>(neocomplcache_snippets_jump)
\ <Plug>(neosnippet_jump_or_expand_impl)
imap <silent> <Plug>(neocomplcache_snippets_force_expand)
\ <Plug>(neosnippet_expand_impl)
smap <silent> <Plug>(neocomplcache_snippets_force_expand)
\ <Plug>(neosnippet_expand_impl)
imap <silent> <Plug>(neocomplcache_snippets_force_jump)
\ <Plug>(neosnippet_jump_impl)
smap <silent> <Plug>(neocomplcache_snippets_force_jump)
\ <Plug>(neosnippet_jump_impl)
"}}}
let g:loaded_neosnippet = 1
let &cpo = s:save_cpo
unlet s:save_cpo
" __END__
" vim: foldmethod=marker