Skip to content

Commit

Permalink
NEWS; allow for eruby nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed May 6, 2007
1 parent 3339278 commit 51fa67d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2007-05-06 Tim Pope <vim@tpope.info>

* NEWS: update documentation for next release
* syntax/eruby.vim: allow for nesting (foo.erb.erb)
* syntax/ruby.vim: removed : from rubyOptionalDoLine (falsely matches
on symbols, and the syntax is deprecated anyways)

2007-05-06 Tim Pope <vim@tpope.info>

* ftplugin/ruby.vim: maps for [[, ]], [], ][, [m, ]m, [M, ]M
Expand Down
54 changes: 54 additions & 0 deletions NEWS
@@ -1,3 +1,57 @@
= 2007.05.07

== Ruby Syntax Highlighting

Highlight OPTIMIZE alongside FIXME and TODO.

Multiline array literals can now be folded.

== Ruby Filetype Support

Added mappings for [[, ]], [], ][, [m, ]m, [M, and ]M. The first four bounce
between class and module declarations, and the last four between method
declarations.

== eRuby Syntax Highlighting

Tim Pope has taken over maintenance of the eRuby syntax file. The subtype of
the file is now determined dynamically from the filename, rather than being
hardwired to HTML. It can be overridden with b:eruby_subtype.

== eRuby Filetype Support

Tim Pope has taken over maintenance of the eRuby filetype plugin. Like with
the syntax file, the subtype is now determined dynamically.

== eRuby Indenting

As with the syntax file and filetype plugin, the subtype is now determined
dynamically.

== Bug Fixes

Ruby syntax file
- when ruby_operators is set, highlight scope and range operators, and don't
match '>' in =>'
- regexp literals are highlighted after the 'else' keyword
- don't match [!=?] as part of a sigil prefixed symbol name
- allow text to appear after, and on the same line, as '=begin' in
rubyDocumentation regions
- highlight %s() ans a symbol, not a string
- eliminated some false positves for here docs, symbols, ASCII codes, and
conditionals as statement modifiers
- added "neus" to regexp flags
- Highlight punctuation variables in string interpolation, and flag invalid
ones as errors
- removed : from rubyOptionalDoLine (falsely matches on symbols)

Ruby filetype plugin
- eliminated some false positives with the matchit patterns

Ruby indent plugin
- ignore instance, class, and global variables named "end"


= 2007.03.02

== Omni Completion
Expand Down
15 changes: 11 additions & 4 deletions syntax/eruby.vim
Expand Up @@ -40,6 +40,13 @@ if !exists("b:eruby_subtype") && main_syntax == 'eruby'
endif
endif

if !exists("b:eruby_nest_level")
let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.erb\>','@','g'),'[^@]','','g'))
endif
if !b:eruby_nest_level
let b:eruby_nest_level = 1
endif

if exists("b:eruby_subtype") && b:eruby_subtype != ''
exe "runtime! syntax/".b:eruby_subtype.".vim"
unlet! b:current_syntax
Expand All @@ -48,10 +55,10 @@ syn include @rubyTop syntax/ruby.vim

syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment

syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline
syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions
syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions
syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend
exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erbRegions keepend oneline'
exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions'
exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=" end="-\=%>" contains=@rubyTop containedin=ALLBUT,@erbRegions'
exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="-\=%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erbRegions keepend'

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
Expand Down
2 changes: 1 addition & 1 deletion syntax/ruby.vim
Expand Up @@ -198,7 +198,7 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
syn keyword rubyConditional then else elsif contained containedin=rubyConditionalExpression

" statements with optional 'do'
syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\|:\)" end="\ze\%(;\|$\)" oneline contains=TOP
syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=TOP
syn region rubyRepeatExpression start="\<for\>" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=TOP nextgroup=rubyOptionalDoLine fold

if !exists("ruby_minlines")
Expand Down

0 comments on commit 51fa67d

Please sign in to comment.