From 3071a45a4cc9e9702a05c4c61c363ce8d6173fe2 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sun, 18 Feb 2018 18:29:42 +0900 Subject: [PATCH] Fix #416 snipMate compatibility --- autoload/neosnippet/parser.vim | 6 ++++-- doc/neosnippet.txt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/neosnippet/parser.vim b/autoload/neosnippet/parser.vim index cf6ad90..5a14313 100644 --- a/autoload/neosnippet/parser.vim +++ b/autoload/neosnippet/parser.vim @@ -144,11 +144,13 @@ function! s:parse_snippet_name(snippets_file, line, linenr, dup_check) abort " SnipMate snippets may have duplicate names, but different " descriptions (abbrs). let description = matchstr(a:line, '^snippet\s\+\S\+\s\+\zs.*$') - if description != '' && description !=# snippet_dict.name + if g:neosnippet#enable_snipmate_compatibility + \ && description != '' && description !=# snippet_dict.name " Convert description. let snippet_dict.name .= '_' . \ substitute(substitute( - \ description, '\W\+', '_', 'g'), '_\+$', '', '') + \ substitute(description, '\a\zs\a\+', '', 'g'), + \ '\W\+', '_', 'g'), '_\+$', '', '') endif " Collect the description (abbr) of the snippet, if set on snippet line. diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index 7ad7823..736ca88 100755 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -192,6 +192,7 @@ g:neosnippet#enable_snipmate_compatibility 2. Load |g:snippets_dir| and snipMate snippets files from 'runtimepath'. 3. Enable file snippets feature in snipMate. + 4. snipMate optional abbr syntax. The default value is 0.