- Implemented commented placeholder.
This commit is contained in:
parent
c1cfe686ad
commit
9e96a69061
@ -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: 29 Oct 2012.
|
" Last Modified: 30 Oct 2012.
|
||||||
" 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
|
||||||
@ -735,6 +735,10 @@ function! s:expand_placeholder(start, end, holder_cnt, line)"{{{
|
|||||||
\ '\\d\\+', a:holder_cnt, '')
|
\ '\\d\\+', a:holder_cnt, '')
|
||||||
let default = substitute(
|
let default = substitute(
|
||||||
\ matchstr(current_line, default_pattern), '\\\ze[^\\]', '', 'g')
|
\ matchstr(current_line, default_pattern), '\\\ze[^\\]', '', 'g')
|
||||||
|
|
||||||
|
let neosnippet = neosnippet#get_current_neosnippet()
|
||||||
|
let neosnippet.selected_text = default
|
||||||
|
|
||||||
" Substitute marker.
|
" Substitute marker.
|
||||||
let default = substitute(default,
|
let default = substitute(default,
|
||||||
\ s:get_placeholder_marker_substitute_pattern(),
|
\ s:get_placeholder_marker_substitute_pattern(),
|
||||||
@ -973,6 +977,7 @@ function! neosnippet#get_selected_text(type, ...)
|
|||||||
let sel_save = &selection
|
let sel_save = &selection
|
||||||
let &selection = 'inclusive'
|
let &selection = 'inclusive'
|
||||||
let reg_save = @@
|
let reg_save = @@
|
||||||
|
let pos = getpos('.')
|
||||||
|
|
||||||
try
|
try
|
||||||
" Invoked from Visual mode, use '< and '> marks.
|
" Invoked from Visual mode, use '< and '> marks.
|
||||||
@ -991,6 +996,7 @@ function! neosnippet#get_selected_text(type, ...)
|
|||||||
finally
|
finally
|
||||||
let &selection = sel_save
|
let &selection = sel_save
|
||||||
let @@ = reg_save
|
let @@ = reg_save
|
||||||
|
call setpos('.', pos)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -361,6 +361,16 @@ Placeholder feature is available. The string after ":" is default value.
|
|||||||
${2}
|
${2}
|
||||||
endif
|
endif
|
||||||
<
|
<
|
||||||
|
Commented placeholder feature is available. If the default value starts with
|
||||||
|
"#:", neosnippet will the delete default value when jump to next placeholder.
|
||||||
|
>
|
||||||
|
snippet if
|
||||||
|
abbr if endif
|
||||||
|
options head
|
||||||
|
if ${1:#:condition}
|
||||||
|
${2}
|
||||||
|
endif
|
||||||
|
<
|
||||||
Note: To contain "}" character in default value, you must escape "}".
|
Note: To contain "}" character in default value, you must escape "}".
|
||||||
>
|
>
|
||||||
snippet test
|
snippet test
|
||||||
@ -454,6 +464,9 @@ snippet *neosnippet-unite-action-snippet*
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
CHANGELOG *neosnippet-changelog*
|
CHANGELOG *neosnippet-changelog*
|
||||||
|
|
||||||
|
2012-10-30
|
||||||
|
- Implemented commented placeholder.
|
||||||
|
|
||||||
2012-10-29
|
2012-10-29
|
||||||
- Improved parse of snippets file.
|
- Improved parse of snippets file.
|
||||||
- Improved syntax of markers.
|
- Improved syntax of markers.
|
||||||
|
@ -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: 29 Oct 2012.
|
" Last Modified: 30 Oct 2012.
|
||||||
" 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
|
||||||
@ -40,22 +40,23 @@ set cpo&vim
|
|||||||
" Plugin key-mappings."{{{
|
" Plugin key-mappings."{{{
|
||||||
inoremap <silent><expr> <Plug>(neosnippet_expand_or_jump)
|
inoremap <silent><expr> <Plug>(neosnippet_expand_or_jump)
|
||||||
\ neosnippet#expand_or_jump_impl()
|
\ neosnippet#expand_or_jump_impl()
|
||||||
snoremap <silent><expr> <Plug>(neosnippet_expand_or_jump)
|
|
||||||
\ neosnippet#expand_or_jump_impl()
|
|
||||||
inoremap <silent><expr> <Plug>(neosnippet_jump_or_expand)
|
inoremap <silent><expr> <Plug>(neosnippet_jump_or_expand)
|
||||||
\ neosnippet#jump_or_expand_impl()
|
\ neosnippet#jump_or_expand_impl()
|
||||||
snoremap <silent><expr> <Plug>(neosnippet_jump_or_expand)
|
|
||||||
\ neosnippet#jump_or_expand_impl()
|
|
||||||
inoremap <silent><expr> <Plug>(neosnippet_expand)
|
inoremap <silent><expr> <Plug>(neosnippet_expand)
|
||||||
\ neosnippet#expand_impl()
|
\ neosnippet#expand_impl()
|
||||||
snoremap <silent><expr> <Plug>(neosnippet_expand)
|
|
||||||
\ neosnippet#expand_impl()
|
|
||||||
inoremap <silent><expr> <Plug>(neosnippet_jump)
|
inoremap <silent><expr> <Plug>(neosnippet_jump)
|
||||||
\ neosnippet#jump_impl()
|
\ neosnippet#jump_impl()
|
||||||
|
snoremap <silent><expr> <Plug>(neosnippet_expand_or_jump)
|
||||||
|
\ neosnippet#expand_or_jump_impl()
|
||||||
|
snoremap <silent><expr> <Plug>(neosnippet_jump_or_expand)
|
||||||
|
\ neosnippet#jump_or_expand_impl()
|
||||||
|
snoremap <silent><expr> <Plug>(neosnippet_expand)
|
||||||
|
\ neosnippet#expand_impl()
|
||||||
snoremap <silent><expr> <Plug>(neosnippet_jump)
|
snoremap <silent><expr> <Plug>(neosnippet_jump)
|
||||||
\ neosnippet#jump_impl()
|
\ neosnippet#jump_impl()
|
||||||
|
|
||||||
" <C-v>:call neosnippet#get_selected_text(visualmode(), 1)<CR><C-v>
|
xnoremap <silent> <Plug>(neosnippet_get_selected_text)
|
||||||
|
\ :call neosnippet#get_selected_text(visualmode(), 1)<CR>
|
||||||
|
|
||||||
imap <silent> <Plug>(neocomplcache_snippets_expand)
|
imap <silent> <Plug>(neocomplcache_snippets_expand)
|
||||||
\ <Plug>(neosnippet_expand_or_jump)
|
\ <Plug>(neosnippet_expand_or_jump)
|
||||||
|
Loading…
Reference in New Issue
Block a user