From c9a8833b60b8a0ee88bd550860643b5edb8c8bda Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Fri, 2 Nov 2012 10:48:55 +0900 Subject: [PATCH] - Added g:neosnippet#enable_snipmate_compatibility option. --- autoload/neosnippet.vim | 18 +++++++++++++++++- doc/neosnippet.txt | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index cd77e7c..95db9cd 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: neosnippet.vim " AUTHOR: Shougo Matsushita -" 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 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') diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index 5d1f4ab..47ae2c9 100644 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -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.