From c8fe2f4b02ac6406d3f80b605f555c62961576f5 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Thu, 17 Feb 2011 14:07:27 +0100 Subject: [PATCH] Added a syntax file by Timo Schmiade. Made sure all shipped files are recognized as snippets, even when ftdetect is not in /Users/sirver --- UltiSnips/all.snippets | 4 +-- UltiSnips/c.snippets | 1 + UltiSnips/cpp.snippets | 2 +- UltiSnips/css.snippets | 1 + UltiSnips/erlang.snippets | 1 + UltiSnips/eruby.snippets | 2 ++ UltiSnips/help.snippets | 1 + UltiSnips/html.snippets | 1 + UltiSnips/java.snippets | 1 + UltiSnips/javascript.snippets | 1 + UltiSnips/mkd.snippets | 2 +- UltiSnips/objc.snippets | 1 + UltiSnips/perl.snippets | 1 + UltiSnips/python.snippets | 1 + UltiSnips/rails.snippets | 2 ++ UltiSnips/rst.snippets | 1 + UltiSnips/sh.snippets | 1 + .../{snippet.snippets => snippets.snippets} | 1 + UltiSnips/tcl.snippets | 1 + UltiSnips/tex.snippets | 1 + UltiSnips/vim.snippets | 1 + doc/UltiSnips.txt | 1 + syntax/snippets.vim | 34 +++++++++++++++++++ 23 files changed, 58 insertions(+), 5 deletions(-) rename UltiSnips/{snippet.snippets => snippets.snippets} (94%) create mode 100644 syntax/snippets.vim diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets index 0a0aa3d..1a5e95a 100644 --- a/UltiSnips/all.snippets +++ b/UltiSnips/all.snippets @@ -48,6 +48,4 @@ snippet lorem "Lorem Ipsum - 50 Words" b Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. endsnippet - - - +# vim:ft=snippets: diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets index 364d8b3..fbdf68f 100644 --- a/UltiSnips/c.snippets +++ b/UltiSnips/c.snippets @@ -93,3 +93,4 @@ struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} }; endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets index c33d08e..9d2eb86 100644 --- a/UltiSnips/cpp.snippets +++ b/UltiSnips/cpp.snippets @@ -49,4 +49,4 @@ snippet tp "template (template)" template endsnippet - +# vim:ft=snippets: diff --git a/UltiSnips/css.snippets b/UltiSnips/css.snippets index 06a2560..d14d51c 100644 --- a/UltiSnips/css.snippets +++ b/UltiSnips/css.snippets @@ -402,3 +402,4 @@ snippet z "z-index: index (z)" z-index: $1;$0 endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/erlang.snippets b/UltiSnips/erlang.snippets index 5474fd8..7823162 100644 --- a/UltiSnips/erlang.snippets +++ b/UltiSnips/erlang.snippets @@ -95,3 +95,4 @@ snippet undef "Undef Directive" -undef (${1:macro}). endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/eruby.snippets b/UltiSnips/eruby.snippets index 86c0de3..122fd11 100644 --- a/UltiSnips/eruby.snippets +++ b/UltiSnips/eruby.snippets @@ -275,3 +275,5 @@ endsnippet snippet lf "link_to_function" `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/help.snippets b/UltiSnips/help.snippets index ad28431..bfa7bc0 100644 --- a/UltiSnips/help.snippets +++ b/UltiSnips/help.snippets @@ -27,3 +27,4 @@ ${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)` $0 endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/html.snippets b/UltiSnips/html.snippets index e977be5..fd4431d 100644 --- a/UltiSnips/html.snippets +++ b/UltiSnips/html.snippets @@ -247,3 +247,4 @@ snippet movie "Embed QT movie (movie)" b endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/java.snippets b/UltiSnips/java.snippets index 6467175..6e1b3ff 100644 --- a/UltiSnips/java.snippets +++ b/UltiSnips/java.snippets @@ -209,3 +209,4 @@ while ($1)`!p nl(snip)`{ } endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index e62abd7..e4e7f7a 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -62,3 +62,4 @@ snippet timeout "setTimeout function" setTimeout(function() {$0}${2:}, ${1:10}); endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/mkd.snippets b/UltiSnips/mkd.snippets index 77541c0..3f100d2 100644 --- a/UltiSnips/mkd.snippets +++ b/UltiSnips/mkd.snippets @@ -41,4 +41,4 @@ snippet img "Link to something" ![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 endsnippet - +# vim:ft=snippets: diff --git a/UltiSnips/objc.snippets b/UltiSnips/objc.snippets index 37db558..0c67664 100644 --- a/UltiSnips/objc.snippets +++ b/UltiSnips/objc.snippets @@ -267,3 +267,4 @@ snippet setprefs "Write to defaults (setprefs)" [[NSUserDefaults standardUserDefaults] setObject:${1:object} forKey:${2:key}]; endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/perl.snippets b/UltiSnips/perl.snippets index 3e8a296..6a9e8f9 100644 --- a/UltiSnips/perl.snippets +++ b/UltiSnips/perl.snippets @@ -124,3 +124,4 @@ while ($1) { endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets index 95f0701..9cc7502 100644 --- a/UltiSnips/python.snippets +++ b/UltiSnips/python.snippets @@ -180,3 +180,4 @@ snippet ar "Assert raises" b self.assertRaises(${1:exception}, ${2:func}${3/.+/, /}${3:arguments}) endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/rails.snippets b/UltiSnips/rails.snippets index 0ca14b7..6ed1529 100644 --- a/UltiSnips/rails.snippets +++ b/UltiSnips/rails.snippets @@ -892,3 +892,5 @@ setup do $0 end endsnippet + +# vim:ft=snippets: diff --git a/UltiSnips/rst.snippets b/UltiSnips/rst.snippets index ae0b8ea..39bbb6c 100644 --- a/UltiSnips/rst.snippets +++ b/UltiSnips/rst.snippets @@ -43,3 +43,4 @@ snippet cb "Code Block" b $0 endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/sh.snippets b/UltiSnips/sh.snippets index 2f438b3..651dd1a 100644 --- a/UltiSnips/sh.snippets +++ b/UltiSnips/sh.snippets @@ -68,3 +68,4 @@ while ${2:[[ ${1:condition} ]]}; do done endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/snippet.snippets b/UltiSnips/snippets.snippets similarity index 94% rename from UltiSnips/snippet.snippets rename to UltiSnips/snippets.snippets index 01bfa6e..87009c4 100644 --- a/UltiSnips/snippet.snippets +++ b/UltiSnips/snippets.snippets @@ -10,3 +10,4 @@ $0 `!p snip.rv = "endsnippet"` endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/tcl.snippets b/UltiSnips/tcl.snippets index 6000abf..2cb1f34 100644 --- a/UltiSnips/tcl.snippets +++ b/UltiSnips/tcl.snippets @@ -47,3 +47,4 @@ while {${1:condition}} { endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets index 2a59b5d..18b10c2 100644 --- a/UltiSnips/tex.snippets +++ b/UltiSnips/tex.snippets @@ -165,3 +165,4 @@ ${0} % subparagraph $2 (end) endsnippet +# vim:ft=snippets: diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets index 299e9ea..f4c37f0 100644 --- a/UltiSnips/vim.snippets +++ b/UltiSnips/vim.snippets @@ -55,3 +55,4 @@ else endif endsnippet +# vim:ft=snippets: diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index fd1486c..b08d60a 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -702,6 +702,7 @@ Contributers are listed in chronological order: Chris Chambers Ryan Wooden rupa - Rupa Deadwyler + Timo Schmiade 7.2 Snippets *UltiSnips-contrisnippets* ------------ diff --git a/syntax/snippets.vim b/syntax/snippets.vim new file mode 100644 index 0000000..33ab808 --- /dev/null +++ b/syntax/snippets.vim @@ -0,0 +1,34 @@ +" Syntax highlighting for snippet files (used for UltiSnips.vim) + +" global matches +syn match snipComment "^#.*" +syn match snipString '"[^"]*"' +syn match snipTabsOnly "^\t\+$" + +syn match snipKeyword "\<\(end\)\?\(snippet\|global\)\>" contained + +" snippet definitions +syn match snipStart "^snippet.*" contained contains=snipKeyword,snipString +syn match snipEnd "^endsnippet" contained contains=snipKeyword +syn region snippet fold keepend start="^snippet" end="^endsnippet" contains=snipStart,snipEnd,snipTabsOnly + +" global definitions +syn match snipGlobalStart "^global.*" contained contains=snipKeyword,snipString +syn match snipGlobalEnd "^endglobal" contained contains=snipKeyword +syn region snipGlobal fold keepend start="^global" end="^endglobal" contains=snipGlobalStart,snipGlobalEnd,snipTabsOnly + +" highlighting rules + +hi link snipComment Comment +hi link snipString String +hi link snipTabsOnly Error + +hi link snipKeyword Keyword + +hi link snipStart Statement +hi link snipEnd Statement +hi link snippet Normal + +hi link snipGlobalStart Statement +hi link snipGlobalEnd Statement +hi link snipGlobal Normal