Implement source feature
This commit is contained in:
parent
74a9c1e8b9
commit
49b1743d03
@ -81,7 +81,7 @@ function! s:parse(snippets_file) "{{{
|
|||||||
if line =~ '^#'
|
if line =~ '^#'
|
||||||
" Ignore.
|
" Ignore.
|
||||||
elseif line =~ '^include'
|
elseif line =~ '^include'
|
||||||
" Include snippets.
|
" Include snippets file.
|
||||||
let filename = matchstr(line, '^include\s\+\zs.*$')
|
let filename = matchstr(line, '^include\s\+\zs.*$')
|
||||||
|
|
||||||
for snippets_file in split(globpath(join(
|
for snippets_file in split(globpath(join(
|
||||||
@ -90,6 +90,13 @@ function! s:parse(snippets_file) "{{{
|
|||||||
let snippets = extend(snippets,
|
let snippets = extend(snippets,
|
||||||
\ neosnippet#parser#_parse_snippets(snippets_file))
|
\ neosnippet#parser#_parse_snippets(snippets_file))
|
||||||
endfor
|
endfor
|
||||||
|
elseif line =~ '^source'
|
||||||
|
" Source Vim script file.
|
||||||
|
for file in split(globpath(join(
|
||||||
|
\ neosnippet#helpers#get_snippets_directory(), ','),
|
||||||
|
\ matchstr(line, '^source\s\+\zs.*$')), '\n')
|
||||||
|
execute 'source' fnameescape(file)
|
||||||
|
endfor
|
||||||
elseif line =~ '^delete\s'
|
elseif line =~ '^delete\s'
|
||||||
let name = matchstr(line, '^delete\s\+\zs.*$')
|
let name = matchstr(line, '^delete\s\+\zs.*$')
|
||||||
if name != '' && has_key(snippets, name)
|
if name != '' && has_key(snippets, name)
|
||||||
|
@ -726,7 +726,12 @@ insert empty line in snippet end, you must insert placeholder.
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
|
||||||
|
You can load a Vim script file for snippets.
|
||||||
|
|
||||||
|
>
|
||||||
|
source go.vim
|
||||||
<
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
UNITE SOURCES *neosnippet-unite-sources*
|
UNITE SOURCES *neosnippet-unite-sources*
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ syntax match neosnippetEscape
|
|||||||
\ '\\[`]' contained
|
\ '\\[`]' contained
|
||||||
|
|
||||||
syntax match neosnippetKeyword
|
syntax match neosnippetKeyword
|
||||||
\ '^\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\|regexp\|TARGET\)' contained
|
\ '^\%(include\|source\|snippet\|abbr\|prev_word\|delete\|alias\|options\|regexp\|TARGET\)' contained
|
||||||
syntax keyword neosnippetOption
|
syntax keyword neosnippetOption
|
||||||
\ head word indent contained
|
\ head word indent contained
|
||||||
syntax match neosnippetPrevWords
|
syntax match neosnippetPrevWords
|
||||||
@ -75,6 +75,10 @@ syntax match neosnippetStatementInclude
|
|||||||
\ '^include\s.*$' contains=neosnippetInclude,neosnippetKeyword
|
\ '^include\s.*$' contains=neosnippetInclude,neosnippetKeyword
|
||||||
syntax match neosnippetInclude
|
syntax match neosnippetInclude
|
||||||
\ '\s\+.*$' contained
|
\ '\s\+.*$' contained
|
||||||
|
syntax match neosnippetStatementSource
|
||||||
|
\ '^source\s.*$' contains=neosnippetSource,neosnippetKeyword
|
||||||
|
syntax match neosnippetSource
|
||||||
|
\ '\s\+.*$' contained
|
||||||
syntax match neosnippetStatementDelete
|
syntax match neosnippetStatementDelete
|
||||||
\ '^delete\s.*$' contains=neosnippetDelete,neosnippetKeyword
|
\ '^delete\s.*$' contains=neosnippetDelete,neosnippetKeyword
|
||||||
syntax match neosnippetDelete
|
syntax match neosnippetDelete
|
||||||
@ -99,6 +103,7 @@ highlight def link neosnippetPlaceHolderComment Comment
|
|||||||
highlight def link neosnippetVariable Special
|
highlight def link neosnippetVariable Special
|
||||||
highlight def link neosnippetComment Comment
|
highlight def link neosnippetComment Comment
|
||||||
highlight def link neosnippetInclude PreProc
|
highlight def link neosnippetInclude PreProc
|
||||||
|
highlight def link neosnippetSource PreProc
|
||||||
highlight def link neosnippetDelete PreProc
|
highlight def link neosnippetDelete PreProc
|
||||||
highlight def link neosnippetOption PreProc
|
highlight def link neosnippetOption PreProc
|
||||||
highlight def link neosnippetAlias Identifier
|
highlight def link neosnippetAlias Identifier
|
||||||
|
Loading…
Reference in New Issue
Block a user