- Splitted mappings file.

This commit is contained in:
Shougo Matsushita 2013-11-18 20:14:01 +09:00
parent afa9ecc176
commit 3ff2918433
3 changed files with 187 additions and 134 deletions

View File

@ -53,7 +53,7 @@ function! neosnippet#initialize() "{{{
call s:initialize_cache()
endfunction"}}}
function! s:check_initialize() "{{{
function! neosnippet#_check_initialize() "{{{
if !exists('s:is_initialized')
call neosnippet#initialize()
endif
@ -72,7 +72,7 @@ function! s:doc_dict.search(cur_text) "{{{
let snippets = neosnippet#get_snippets()
let cur_word = s:get_cursor_snippet(snippets, a:cur_text)
let cur_word = neosnippet#get_cursor_snippet(snippets, a:cur_text)
if cur_word == ''
return []
endif
@ -92,13 +92,13 @@ function! neosnippet#expandable_or_jumpable() "{{{
endfunction"}}}
function! neosnippet#expandable() "{{{
" Check snippet trigger.
return s:get_cursor_snippet(
return neosnippet#get_cursor_snippet(
\ neosnippet#get_snippets(), neosnippet#util#get_cur_text()) != ''
endfunction"}}}
function! neosnippet#jumpable() "{{{
" Found snippet placeholder.
return search(s:get_placeholder_marker_pattern(). '\|'
\ .s:get_sync_placeholder_marker_pattern(), 'nw') > 0
return search(neosnippet#get_placeholder_marker_pattern(). '\|'
\ .neosnippet#get_sync_placeholder_marker_pattern(), 'nw') > 0
endfunction"}}}
function! neosnippet#caching() "{{{
@ -133,7 +133,7 @@ endfunction"}}}
function! s:initialize_snippet(dict, path, line, pattern, name) "{{{
let a:dict.word = substitute(a:dict.word, '\n\+$', '', '')
if a:dict.word !~
\ s:get_placeholder_marker_substitute_pattern()
\ neosnippet#get_placeholder_marker_substitute_pattern()
" Add placeholder.
let a:dict.word .= '${0}'
endif
@ -143,8 +143,8 @@ function! s:initialize_snippet(dict, path, line, pattern, name) "{{{
if !has_key(a:dict, 'abbr') || a:dict.abbr == ''
" Set default abbr.
let abbr = substitute(a:dict.word,
\ s:get_placeholder_marker_pattern(). '\|'.
\ s:get_mirror_placeholder_marker_pattern().
\ neosnippet#get_placeholder_marker_pattern(). '\|'.
\ neosnippet#get_mirror_placeholder_marker_pattern().
\ '\|\s\+\|\n\|TARGET', ' ', 'g')
let a:dict.abbr = a:dict.name
else
@ -178,7 +178,7 @@ function! neosnippet#edit_snippets(args) "{{{
return
endif
call s:check_initialize()
call neosnippet#_check_initialize()
let [args, options] = neosnippet#util#parse_options(
\ a:args, s:neosnippet_options)
@ -242,7 +242,7 @@ function! s:initialize_options(options) "{{{
endfunction"}}}
function! neosnippet#make_cache(filetype) "{{{
call s:check_initialize()
call neosnippet#_check_initialize()
let filetype = a:filetype == '' ?
\ &filetype : a:filetype
@ -271,7 +271,7 @@ function! neosnippet#make_cache(filetype) "{{{
endfunction"}}}
function! neosnippet#source_file(filename) "{{{
call s:check_initialize()
call neosnippet#_check_initialize()
let neosnippet = neosnippet#get_current_neosnippet()
call s:parse_snippets_file(neosnippet.snippets, a:filename)
@ -434,7 +434,7 @@ function! s:is_beginning_of_line(cur_text) "{{{
return prev_word_end <= 0
endfunction"}}}
function! s:get_cursor_snippet(snippets, cur_text) "{{{
function! neosnippet#get_cursor_snippet(snippets, cur_text) "{{{
let cur_word = matchstr(a:cur_text, '\S\+$')
if cur_word != '' && has_key(a:snippets, cur_word)
return cur_word
@ -452,14 +452,6 @@ function! s:get_cursor_snippet(snippets, cur_text) "{{{
return cur_word
endfunction"}}}
function! s:snippets_expand(cur_text, col) "{{{
let cur_word = s:get_cursor_snippet(
\ neosnippet#get_snippets(),
\ a:cur_text)
call neosnippet#expand(
\ a:cur_text, a:col, cur_word)
endfunction"}}}
function! neosnippet#jump(cur_text, col) "{{{
call s:skip_next_auto_completion()
@ -491,31 +483,6 @@ function! neosnippet#jump(cur_text, col) "{{{
return s:search_outof_range(a:col)
endfunction"}}}
function! s:snippets_expand_or_jump(cur_text, col) "{{{
let cur_word = s:get_cursor_snippet(
\ neosnippet#get_snippets(), a:cur_text)
if cur_word != ''
" Found snippet trigger.
call neosnippet#expand(
\ a:cur_text, a:col, cur_word)
else
call neosnippet#jump(a:cur_text, a:col)
endif
endfunction"}}}
function! s:snippets_jump_or_expand(cur_text, col) "{{{
let cur_word = s:get_cursor_snippet(
\ neosnippet#get_snippets(), a:cur_text)
if search(s:get_placeholder_marker_pattern(). '\|'
\ .s:get_sync_placeholder_marker_pattern(), 'nw') > 0
" Found snippet placeholder.
call neosnippet#jump(a:cur_text, a:col)
else
call neosnippet#expand(
\ a:cur_text, a:col, cur_word)
endif
endfunction"}}}
function! neosnippet#expand(cur_text, col, trigger_name) "{{{
call s:skip_next_auto_completion()
@ -548,14 +515,14 @@ function! neosnippet#expand(cur_text, col, trigger_name) "{{{
" Substitute markers.
let snip_word = substitute(snip_word,
\ '\\\@<!'.s:get_placeholder_marker_substitute_pattern(),
\ '\\\@<!'.neosnippet#get_placeholder_marker_substitute_pattern(),
\ '<`\1`>', 'g')
let snip_word = substitute(snip_word,
\ '\\\@<!'.s:get_mirror_placeholder_marker_substitute_pattern(),
\ '\\\@<!'.neosnippet#get_mirror_placeholder_marker_substitute_pattern(),
\ '<|\1|>', 'g')
let snip_word = substitute(snip_word,
\ '\\'.s:get_mirror_placeholder_marker_substitute_pattern().'\|'.
\ '\\'.s:get_placeholder_marker_substitute_pattern(),
\ '\\'.neosnippet#get_mirror_placeholder_marker_substitute_pattern().'\|'.
\ '\\'.neosnippet#get_placeholder_marker_substitute_pattern(),
\ '\=submatch(0)[1:]', 'g')
" Insert snippets.
@ -601,7 +568,7 @@ function! neosnippet#expand(cur_text, col, trigger_name) "{{{
\ 'holder_cnt' : 1,
\ })
if snip_word =~ s:get_placeholder_marker_pattern()
if snip_word =~ neosnippet#get_placeholder_marker_pattern()
call neosnippet#jump(a:cur_text, a:col)
endif
finally
@ -756,7 +723,7 @@ function! s:search_snippet_range(start, end, cnt, ...) "{{{
call s:substitute_placeholder_marker(a:start, a:end, a:cnt)
" Search marker pattern.
let pattern = substitute(s:get_placeholder_marker_pattern(),
let pattern = substitute(neosnippet#get_placeholder_marker_pattern(),
\ '\\d\\+', a:cnt, '')
for line in filter(range(a:start, a:end),
@ -770,7 +737,7 @@ endfunction"}}}
function! s:search_outof_range(col) "{{{
call s:substitute_placeholder_marker(1, 0, 0)
let pattern = s:get_placeholder_marker_pattern()
let pattern = neosnippet#get_placeholder_marker_pattern()
if search(pattern, 'w') > 0
call s:expand_placeholder(line('.'), 0, '\\d\\+', line('.'))
return 1
@ -795,14 +762,14 @@ endfunction"}}}
function! s:expand_placeholder(start, end, holder_cnt, line, ...) "{{{
let is_select = get(a:000, 0, 1)
let pattern = substitute(s:get_placeholder_marker_pattern(),
let pattern = substitute(neosnippet#get_placeholder_marker_pattern(),
\ '\\d\\+', a:holder_cnt, '')
let current_line = getline(a:line)
let match = match(current_line, pattern)
let neosnippet = neosnippet#get_current_neosnippet()
let default_pattern = substitute(
\ s:get_placeholder_marker_default_pattern(),
\ neosnippet#get_placeholder_marker_default_pattern(),
\ '\\d\\+', a:holder_cnt, '')
let default = substitute(
\ matchstr(current_line, default_pattern),
@ -821,10 +788,10 @@ function! s:expand_placeholder(start, end, holder_cnt, line, ...) "{{{
" Substitute marker.
let default = substitute(default,
\ s:get_placeholder_marker_substitute_pattern(),
\ neosnippet#get_placeholder_marker_substitute_pattern(),
\ '<`\1`>', 'g')
let default = substitute(default,
\ s:get_mirror_placeholder_marker_substitute_pattern(),
\ neosnippet#get_mirror_placeholder_marker_substitute_pattern(),
\ '<|\1|>', 'g')
" len() cannot use for multibyte.
@ -836,7 +803,7 @@ function! s:expand_placeholder(start, end, holder_cnt, line, ...) "{{{
let cnt = s:search_sync_placeholder(a:start, a:end, a:holder_cnt)
if cnt >= 0
let pattern = substitute(s:get_placeholder_marker_pattern(),
let pattern = substitute(neosnippet#get_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
call setline(a:line, substitute(current_line, pattern,
\ '<{'.cnt.':'.escape(default, '\').'}>', ''))
@ -915,15 +882,15 @@ function! s:search_sync_placeholder(start, end, number) "{{{
if a:end == 0
" Search in current buffer.
let cnt = matchstr(getline('.'),
\ substitute(s:get_placeholder_marker_pattern(),
\ substitute(neosnippet#get_placeholder_marker_pattern(),
\ '\\d\\+', '\\zs\\d\\+\\ze', ''))
return search(substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ neosnippet#get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', cnt, ''), 'nw') > 0 ? cnt : -1
endif
let pattern = substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ neosnippet#get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', a:number, '')
for line in filter(range(a:start, a:end),
\ 'getline(v:val) =~ pattern')
@ -935,35 +902,35 @@ endfunction"}}}
function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt) "{{{
if a:snippet_holder_cnt > 0
let cnt = a:snippet_holder_cnt-1
let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(),
let sync_marker = substitute(neosnippet#get_sync_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
let mirror_marker = substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ neosnippet#get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
let line = a:start
for line in range(a:start, a:end)
if getline(line) =~ sync_marker
let sub = escape(matchstr(getline(line),
\ substitute(s:get_sync_placeholder_marker_default_pattern(),
\ substitute(neosnippet#get_sync_placeholder_marker_default_pattern(),
\ '\\d\\+', cnt, '')), '/\')
silent execute printf('%d,%ds/\m' . mirror_marker . '/%s/'
\ . (&gdefault ? '' : 'g'), a:start, a:end, sub)
call setline(line, substitute(getline(line), sync_marker, sub, ''))
endif
endfor
elseif search(s:get_sync_placeholder_marker_pattern(), 'wb') > 0
elseif search(neosnippet#get_sync_placeholder_marker_pattern(), 'wb') > 0
let sub = escape(matchstr(getline('.'),
\ s:get_sync_placeholder_marker_default_pattern()), '/\')
\ neosnippet#get_sync_placeholder_marker_default_pattern()), '/\')
let cnt = matchstr(getline('.'),
\ substitute(s:get_sync_placeholder_marker_pattern(),
\ substitute(neosnippet#get_sync_placeholder_marker_pattern(),
\ '\\d\\+', '\\zs\\d\\+\\ze', ''))
let mirror_marker = substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ neosnippet#get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
silent execute printf('%%s/\m' . mirror_marker . '/%s/'
\ . (&gdefault ? 'g' : ''), sub)
let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(),
let sync_marker = substitute(neosnippet#get_sync_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
call setline('.', substitute(getline('.'), sync_marker, sub, ''))
endif
@ -1003,7 +970,7 @@ function! neosnippet#get_current_neosnippet() "{{{
return b:neosnippet
endfunction"}}}
function! neosnippet#get_snippets() "{{{
call s:check_initialize()
call neosnippet#_check_initialize()
let neosnippet = neosnippet#get_current_neosnippet()
let snippets = copy(neosnippet.snippets)
@ -1026,7 +993,7 @@ function! neosnippet#get_snippets() "{{{
return snippets
endfunction"}}}
function! neosnippet#get_snippets_directory() "{{{
call s:check_initialize()
call neosnippet#_check_initialize()
let snippets_dir = copy(s:snippets_dir)
if !get(g:neosnippet#disable_runtime_snippets,
@ -1038,12 +1005,12 @@ function! neosnippet#get_snippets_directory() "{{{
return snippets_dir
endfunction"}}}
function! neosnippet#get_user_snippets_directory() "{{{
call s:check_initialize()
call neosnippet#_check_initialize()
return copy(s:snippets_dir)
endfunction"}}}
function! neosnippet#get_runtime_snippets_directory() "{{{
call s:check_initialize()
call neosnippet#_check_initialize()
return copy(s:runtime_dir)
endfunction"}}}
@ -1106,57 +1073,28 @@ endfunction"}}}
function! neosnippet#get_placeholder_target_marker_pattern() "{{{
return '\${\d\+:TARGET\%(:.\{-}\)\?\\\@<!}'
endfunction"}}}
function! s:get_placeholder_marker_pattern() "{{{
function! neosnippet#get_placeholder_marker_pattern() "{{{
return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
endfunction"}}}
function! s:get_placeholder_marker_substitute_pattern() "{{{
function! neosnippet#get_placeholder_marker_substitute_pattern() "{{{
return '\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}'
endfunction"}}}
function! s:get_placeholder_marker_default_pattern() "{{{
function! neosnippet#get_placeholder_marker_default_pattern() "{{{
return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
endfunction"}}}
function! s:get_sync_placeholder_marker_pattern() "{{{
function! neosnippet#get_sync_placeholder_marker_pattern() "{{{
return '<{\d\+\%(:.\{-}\)\?\\\@<!}>'
endfunction"}}}
function! s:get_sync_placeholder_marker_default_pattern() "{{{
function! neosnippet#get_sync_placeholder_marker_default_pattern() "{{{
return '<{\d\+:\zs.\{-}\ze\\\@<!}>'
endfunction"}}}
function! s:get_mirror_placeholder_marker_pattern() "{{{
function! neosnippet#get_mirror_placeholder_marker_pattern() "{{{
return '<|\d\+|>'
endfunction"}}}
function! s:get_mirror_placeholder_marker_substitute_pattern() "{{{
function! neosnippet#get_mirror_placeholder_marker_substitute_pattern() "{{{
return '\$\(\d\+\)'
endfunction"}}}
function! s:SID_PREFIX() "{{{
return matchstr(expand('<sfile>'), '<SNR>\d\+_')
endfunction"}}}
function! s:trigger(function) "{{{
call s:check_initialize()
let cur_text = neosnippet#util#get_cur_text()
let col = col('.')
let expr = ''
if mode() !=# 'i'
" Fix column.
let col += 2
endif
" Get selected text.
let neosnippet = neosnippet#get_current_neosnippet()
let neosnippet.trigger = 1
if mode() ==# 's' && neosnippet.selected_text =~ '^#:'
let expr .= "a\<BS>"
endif
let expr .= printf("\<ESC>:call %s(%s,%d)\<CR>",
\ a:function, string(cur_text), col)
return expr
endfunction"}}}
function! neosnippet#get_selected_text(type, ...) "{{{
let sel_save = &selection
let &selection = 'inclusive'
@ -1326,20 +1264,6 @@ if g:neosnippet#enable_snipmate_compatibility
endfunction
endif
" Plugin key-mappings.
function! neosnippet#expand_or_jump_impl()
return s:trigger(s:SID_PREFIX().'snippets_expand_or_jump')
endfunction
function! neosnippet#jump_or_expand_impl()
return s:trigger(s:SID_PREFIX().'snippets_jump_or_expand')
endfunction
function! neosnippet#expand_impl()
return s:trigger(s:SID_PREFIX().'snippets_expand')
endfunction
function! neosnippet#jump_impl()
return s:trigger('neosnippet#jump')
endfunction
function! s:initialize_script_variables() "{{{
" Initialize.
let s:snippets_expand_stack = []
@ -1393,9 +1317,9 @@ function! s:initialize_others() "{{{
augroup neosnippet
autocmd BufNewFile,BufRead,Syntax *
\ execute 'syntax match neosnippetExpandSnippets'
\ "'".s:get_placeholder_marker_pattern(). '\|'
\ .s:get_sync_placeholder_marker_pattern().'\|'
\ .s:get_mirror_placeholder_marker_pattern()."'"
\ "'".neosnippet#get_placeholder_marker_pattern(). '\|'
\ .neosnippet#get_sync_placeholder_marker_pattern().'\|'
\ .neosnippet#get_mirror_placeholder_marker_pattern()."'"
\ 'containedin=ALL oneline'
if has('conceal')
autocmd BufNewFile,BufRead,Syntax *

View File

@ -0,0 +1,129 @@
"=============================================================================
" FILE: mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 18 Nov 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
" "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.
" }}}
"=============================================================================
let s:save_cpo = &cpo
set cpo&vim
function! s:snippets_expand(cur_text, col) "{{{
let cur_word = neosnippet#get_cursor_snippet(
\ neosnippet#get_snippets(),
\ a:cur_text)
call neosnippet#expand(
\ a:cur_text, a:col, cur_word)
endfunction"}}}
function! neosnippet#mappings#_get_cursor_snippet(snippets, cur_text) "{{{
let cur_word = matchstr(a:cur_text, '\S\+$')
if cur_word != '' && has_key(a:snippets, cur_word)
return cur_word
endif
while cur_word != ''
if has_key(a:snippets, cur_word) &&
\ a:snippets[cur_word].options.word
return cur_word
endif
let cur_word = substitute(cur_word, '^\%(\w\+\|\W\)', '', '')
endwhile
return cur_word
endfunction"}}}
function! s:snippets_expand_or_jump(cur_text, col) "{{{
let cur_word = neosnippet#get_cursor_snippet(
\ neosnippet#get_snippets(), a:cur_text)
if cur_word != ''
" Found snippet trigger.
call neosnippet#expand(
\ a:cur_text, a:col, cur_word)
else
call neosnippet#jump(a:cur_text, a:col)
endif
endfunction"}}}
function! s:snippets_jump_or_expand(cur_text, col) "{{{
let cur_word = neosnippet#get_cursor_snippet(
\ neosnippet#get_snippets(), a:cur_text)
if search(neosnippet#get_placeholder_marker_pattern(). '\|'
\ .neosnippet#get_sync_placeholder_marker_pattern(), 'nw') > 0
" Found snippet placeholder.
call neosnippet#jump(a:cur_text, a:col)
else
call neosnippet#expand(
\ a:cur_text, a:col, cur_word)
endif
endfunction"}}}
function! s:SID_PREFIX() "{{{
return matchstr(expand('<sfile>'), '<SNR>\d\+_')
endfunction"}}}
function! s:trigger(function) "{{{
call neosnippet#_check_initialize()
let cur_text = neosnippet#util#get_cur_text()
let col = col('.')
let expr = ''
if mode() !=# 'i'
" Fix column.
let col += 2
endif
" Get selected text.
let neosnippet = neosnippet#get_current_neosnippet()
let neosnippet.trigger = 1
if mode() ==# 's' && neosnippet.selected_text =~ '^#:'
let expr .= "a\<BS>"
endif
let expr .= printf("\<ESC>:call %s(%s,%d)\<CR>",
\ a:function, string(cur_text), col)
return expr
endfunction"}}}
" Plugin key-mappings.
function! neosnippet#mappings#expand_or_jump_impl()
return s:trigger(s:SID_PREFIX().'snippets_expand_or_jump')
endfunction
function! neosnippet#mappings#jump_or_expand_impl()
return s:trigger(s:SID_PREFIX().'snippets_jump_or_expand')
endfunction
function! neosnippet#mappings#expand_impl()
return s:trigger(s:SID_PREFIX().'snippets_expand')
endfunction
function! neosnippet#mappings#jump_impl()
return s:trigger('neosnippet#jump')
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: foldmethod=marker

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 04 Jun 2013.
" Last Modified: 18 Nov 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
@ -39,21 +39,21 @@ set cpo&vim
" Plugin key-mappings. "{{{
inoremap <silent><expr> <Plug>(neosnippet_expand_or_jump)
\ neosnippet#expand_or_jump_impl()
\ neosnippet#mappings#expand_or_jump_impl()
inoremap <silent><expr> <Plug>(neosnippet_jump_or_expand)
\ neosnippet#jump_or_expand_impl()
\ neosnippet#mappings#jump_or_expand_impl()
inoremap <silent><expr> <Plug>(neosnippet_expand)
\ neosnippet#expand_impl()
\ neosnippet#mappings#expand_impl()
inoremap <silent><expr> <Plug>(neosnippet_jump)
\ neosnippet#jump_impl()
\ neosnippet#mappings#jump_impl()
snoremap <silent><expr> <Plug>(neosnippet_expand_or_jump)
\ neosnippet#expand_or_jump_impl()
\ neosnippet#mappings#expand_or_jump_impl()
snoremap <silent><expr> <Plug>(neosnippet_jump_or_expand)
\ neosnippet#jump_or_expand_impl()
\ neosnippet#mappings#jump_or_expand_impl()
snoremap <silent><expr> <Plug>(neosnippet_expand)
\ neosnippet#expand_impl()
\ neosnippet#mappings#expand_impl()
snoremap <silent><expr> <Plug>(neosnippet_jump)
\ neosnippet#jump_impl()
\ neosnippet#mappings#jump_impl()
xnoremap <silent> <Plug>(neosnippet_get_selected_text)
\ :call neosnippet#get_selected_text(visualmode(), 1)<CR>