Skip to content

Commit

Permalink
Improved syntax file and ftplugin for SnipMate snippets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanillma committed Jul 15, 2024
1 parent ce0a05a commit 1e0a7be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions ftplugin/snippets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1

let b:undo_ftplugin = "setl et< sts< cms< fdm< fde<"
let b:undo_ftplugin = "setl cms< fdm< fde<"

" Use hard tabs
setlocal noexpandtab softtabstop=0
setlocal foldmethod=expr foldexpr=getline(v:lnum)=~'^#\\\|^e\\\|^p'?0:getline(v:lnum)!~'^\\t\\\|^\ \\\|^$'?'>1':1

setlocal commentstring=#\ %s
setlocal nospell
5 changes: 2 additions & 3 deletions syntax/snippets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ syn match snipCommand '\%(\\\@<!\%(\\\\\)*\)\@<=`.\{-}\%(\\\@<!\%(\\\\\)*\)\@<=`
syn match snippet '^snippet.*' contains=multiSnipText,snipKeyword
syn match snippet '^autosnippet.*' contains=multiSnipText,snipKeyword
syn match snippet '^extends.*' contains=snipKeyword
syn match snippet '^version.*' contains=snipKeyword
syn match snippet '^priority.*' contains=snipKeyword,priority
syn match priority '\d\+' contained
syn match multiSnipText '\S\+ \zs.*' contained
syn match snipKeyword '^(snippet|extends|version|autosnippet|priority)'me=s+8 contained
syn match snipKeyword '^\%(snippet\|extends\|autosnippet\|priority\)' contained
" normally we'd want a \s in that group, but that doesn't work => cover common
" cases with \t and " ".
syn match snipError "^[^#vsaep\t ].*$"
syn match snipError '^[^#saep\t ].*$'

hi link snippet Identifier
hi link snipComment Comment
Expand Down

0 comments on commit 1e0a7be

Please sign in to comment.