Updated to fit new version of nomsu and to be less buggy

This commit is contained in:
Bruce Hill 2017-09-20 04:39:41 -07:00
parent 866116004a
commit 9538b2983f
2 changed files with 43 additions and 38 deletions

View File

@ -24,7 +24,7 @@ function! GetNomsuIndent()
let previous = getline(previousNum)
let ind = indent(previousNum)
if previous =~ ':$' || previous =~ '\.\.$' || previous =~ '(\.\.)$' || previous =~ '\[\.\.\]$' || previous =~ '"\.\."$' || previous =~ '#\.\..*$'
if previous =~ ':$' || previous =~ '(\.\.)$' || previous =~ '\[\.\.\]$' || previous =~ '"\.\."$' || previous =~ '#\.\..*$'
let ind += &tabstop
endif

View File

@ -9,62 +9,67 @@ endif
" Highlight long strings.
syn sync minlines=100
"highlight String ctermbg=DarkBlue ctermfg=Black
" Regular strings
"
syn region nomsuInterp matchgroup=nomsuInterpDelim start=/\\/ end=/\\/ contained
\ contains=@nomsuAll
hi def link nomsuInterpDelim PreProc
syn region nomsuOneLineComment start=/#/ end=/$/
syn region nomsuOneLineComment start=/#\(\.\.\)\@!/ end=/$/
hi nomsuOneLineComment ctermfg=DarkBlue
hi def link nomsuOneLineComment Comment
syn region nomsuComment start=/#\.\.[^\n]*$\n\(\s*\n\)*\z(\s\+\)\S/ skip=/^\%(\z1\S\|^\s*$\)/ end=/^\z1\@!.*/me=s-1
syn region nomsuComment start=/\(\n\z(\s*\)[^\n]*\)\@<=#\.\./ skip=/\n\s*$/ end=/\n\(\z1\s\)\@!/
hi nomsuComment ctermfg=DarkBlue
hi def link nomsuComment Comment
syn region nomsuString1 start=/"\(\(\.\."\)\@!\|\.\."\s*|.*$\)/ skip=/\\\\\|\\"/ end=/"/
hi def link nomsuString1 String
syn region nomsuStringLine start=/"\.\."/ end=/$/
\ contains=nomsuInterp,nomsuStringLineStart,nomsuStringTrailingSpace,nomsuOneLineComment,nomsuComment
hi def link nomsuStringLine String
syn match nomsuStringLineStart /\(^[ \t]*\|"\.\."\s*\)\@<=|/ contained
hi def link nomsuStringLineStart Delimiter
syn match nomsuStringTrailingSpace /[ \t]*$/ contained
hi nomsuStringTrailingSpace ctermbg=Magenta
syn region nomsuShortString start=/\("\.\.\)\@<!"\(\.\."\)\@!/ skip=/\\\\\|\\"/ end=/"/
hi nomsuShortString ctermfg=Magenta
hi def link nomsuShortString String
syn region nomsuLongString start=/"\.\."[^\n]*$\n\(\s*\n\)*\z(\s\+\)\S/ skip=/^\%(\z1\S\|^\s*$\)/ end=/^\z1\@!.*/me=s-1
\ contains=nomsuInterp,nomsuStringLineStart,nomsuStringTrailingSpace,nomsuOneLineComment,nomsuComment
hi def link nomsuLongString String
syn match nomsuLongStringStart /"\.\."/ contains=nomsuIndentor contained
hi nomsuLongStringStart ctermfg=Yellow
syn match nomsuStringPipe /|/ contained
hi nomsuStringPipe ctermfg=DarkGray
hi def link nomsuStringPipe Special
syn region nomsuInterp matchgroup=nomsuInterpDelim start=/\\/ end=/\\/ contained
\ contains=@nomsuAll
syn region nomsuLongStringValue start=/\(|\)\@<=/ end=/\(\n\)\@=/ contained
\ contains=nomsuInterp
hi nomsuLongStringValue ctermbg=Black ctermfg=Gray
hi def link nomsuLongStringValue String
syn region nomsuLongStringFirstLine start=/\("\.\."\s*\)\@<=|/ end=/$/ contained
\ contains=nomsuStringPipe,nomsuLongStringValue
syn region nomsuLongStringLine start=/^\s\+|/ end=/$/ contained
\ contains=nomsuStringPipe,nomsuLongStringValue
syn region nomsuLongString start=/\(^\z(\s*\)[^\n]*\)\@<="\.\."/ skip=/^\s*$/ end=/^\(\z1\s\)\@!/
\ contains=nomsuLongStringStart,nomsuOneLineComment,nomsuComment,nomsuLongStringLine,nomsuLongStringFirstLine
syn match nomsuVar /\v\%[a-zA-Z0-9_'+*/^&$@-][a-zA-Z0-9_+*/^&$@-]*/
syn match nomsuVar /\v\%[a-zA-Z0-9`~!@^&*_+=|<>?'-][a-zA-Z0-9`~!@^&*_+=|<>?-]*/
hi nomsuVar ctermfg=Cyan
hi def link nomsuVar Identifier
syn match nomsuNumber /\v([a-zA-Z])@<!\d+\.\d+/
syn match nomsuNumber /\v([a-zA-Z])@<!\d+/
syn match nomsuWord /\v[a-zA-Z0-9`~!@^&*_+=|<>?'-][a-zA-Z0-9`~!@^&*_+=|<>?-]*/
hi def link nomsuWord Function
hi nomsuWord ctermfg=White
syn match nomsuNumber /-\?\d\+\(\.\(\d\+\)\?\)\?/
syn match nomsuNumber /-\?\.\d\+/
hi def link nomsuNumber Number
syn match nomsuIndentor /\[\.\.\]/
syn match nomsuIndentor /(\.\.)/
syn match nomsuIndentor /\.\.\s*$/
syn match nomsuIndentor /^\s*\.\./
hi def link nomsuIndentor Special
syn match nomsuIndentor /\.\./
hi def link nomsuIndentor Delimiter
hi def link nomsuIndentor Special
hi nomsuIndentor ctermfg=DarkGray
syn match nomsuComma /,/
hi def link nomsuComma Delimiter
syn match nomsuDelim /[,()\[\]]/
hi nomsuDelim ctermfg=Yellow
hi def link nomsuDelim Delimiter
syn match nomsuThunk /:/
hi nomsuThunk ctermfg=Yellow
hi def link nomsuThunk Structure
syn match nomsuToken /\v(\%)@<!\%[a-zA-Z_'+*/^&$@#-][a-zA-Z0-9_+*/^&$@#-]*/
hi def link nomsuToken Function
syn cluster nomsuAll contains=nomsuString1,nomsuLongString,nomsuComment,
\ nomsuVar,nomsuNumber,nomsuComma,nomsuThunk,nomsuIndentor,nomsuToken
syn cluster nomsuAll contains=nomsuShortString,nomsuLongString,nomsuComment,nomsuOneLineComment,
\ nomsuVar,nomsuNumber,nomsuDelim,nomsuThunk,nomsuIndentor,nomsuWord
if !exists('b:current_syntax')
let b:current_syntax = 'nomsu'