Fix #416 snipMate compatibility
This commit is contained in:
parent
5f436616ba
commit
3071a45a4c
@ -144,11 +144,13 @@ function! s:parse_snippet_name(snippets_file, line, linenr, dup_check) abort
|
|||||||
" SnipMate snippets may have duplicate names, but different
|
" SnipMate snippets may have duplicate names, but different
|
||||||
" descriptions (abbrs).
|
" descriptions (abbrs).
|
||||||
let description = matchstr(a:line, '^snippet\s\+\S\+\s\+\zs.*$')
|
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.
|
" Convert description.
|
||||||
let snippet_dict.name .= '_' .
|
let snippet_dict.name .= '_' .
|
||||||
\ substitute(substitute(
|
\ substitute(substitute(
|
||||||
\ description, '\W\+', '_', 'g'), '_\+$', '', '')
|
\ substitute(description, '\a\zs\a\+', '', 'g'),
|
||||||
|
\ '\W\+', '_', 'g'), '_\+$', '', '')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Collect the description (abbr) of the snippet, if set on snippet line.
|
" Collect the description (abbr) of the snippet, if set on snippet line.
|
||||||
|
@ -192,6 +192,7 @@ g:neosnippet#enable_snipmate_compatibility
|
|||||||
2. Load |g:snippets_dir| and snipMate snippets files from
|
2. Load |g:snippets_dir| and snipMate snippets files from
|
||||||
'runtimepath'.
|
'runtimepath'.
|
||||||
3. Enable file snippets feature in snipMate.
|
3. Enable file snippets feature in snipMate.
|
||||||
|
4. snipMate optional abbr syntax.
|
||||||
|
|
||||||
The default value is 0.
|
The default value is 0.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user