- Added g:neosnippet#enable_snipmate_compatibility option.

This commit is contained in:
Shougo Matsushita 2012-11-02 10:48:55 +09:00
parent 3300aafd8e
commit c9a8833b60
2 changed files with 38 additions and 1 deletions

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 01 Nov 2012.
" Last Modified: 02 Nov 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
@ -36,6 +36,8 @@ call neosnippet#util#set_default(
call neosnippet#util#set_default(
\ 'g:neosnippet#disable_select_mode_mappings',
\ 1, 'g:neocomplcache_disable_select_mode_mappings')
call neosnippet#util#set_default(
\ 'g:neosnippet#enable_snipmate_compatibility', 0)
"}}}
" Variables "{{{
@ -1198,6 +1200,20 @@ function! neosnippet#clear_select_mode_mappings()"{{{
snoremap <left> <ESC>bi
endfunction"}}}
if g:neosnippet#enable_snipmate_compatibility
" For snipMate function.
function! Filename(...)
let filename = expand('%:t:r')
if filename == ''
return a:0 == 2 ? a:2 : ''
elseif a:0 == 0 || a:1 == ''
return filename
else
return substitute(a:1, '$1', filename, 'g')
endif
endfunction
endif
" Plugin key-mappings.
function! neosnippet#expand_or_jump_impl()
return s:trigger(s:SID_PREFIX().'snippets_expand_or_jump')

View File

@ -189,6 +189,13 @@ g:neosnippet#disable_runtime_snippets
The default value is {}.
g:neosnippet#enable_snipmate_compatibility
*g:neosnippet#enable_snipmate_compatibility*
If it is non 0, neosnippet will enable snipMate compatibility
feature(For example: Filename() function).
The default value is 0.
------------------------------------------------------------------------------
KEY MAPPINGS *neosnippet-key-mappings*
@ -327,6 +334,9 @@ EXAMPLES *neosnippet-examples*
if has('conceal')
set conceallevel=2 concealcursor=i
endif
" Enable snipMate compatibility feature.
" let g:neosnippet#enable_snipmate_compatibility = 1
<
==============================================================================
SNIPPET SYNTAX *neosnippet-snippet-syntax*
@ -634,9 +644,20 @@ Note: But you must unmap the mappings in select mode manually.
let g:neosnippet#disable_select_mode_mappings = 0
<
Q: Error using snipmate-snippets
https://github.com/Shougo/neosnippet/issues/86
A: Please try below settings. It defines snipMate function.
>
let g:neosnippet#enable_snipmate_compatibility = 1
<
==============================================================================
CHANGELOG *neosnippet-changelog*
2012-11-02
- Added g:neosnippet#enable_snipmate_compatibility option.
2012-11-01
- Fixed snippet mirror behavior.
- Fixed substitute of target.