Skip to content

Commit 4480f1d

Browse files
committed
Give "Special Methods" lower precedence
This fixes, among other things: {include: :comments}
1 parent 098f8dd commit 4480f1d

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

syntax/ruby.vim

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ if exists("ruby_operators")
3737
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop
3838
endif
3939

40+
" Special Methods
41+
if !exists("ruby_no_special_methods")
42+
syn keyword rubyAccess public protected private module_function
43+
" attr is a common variable name
44+
syn match rubyAttribute "\%(\%(^\|;\)\s*\)\@<=attr\>\(\s*[.=]\)\@!"
45+
syn keyword rubyAttribute attr_accessor attr_reader attr_writer
46+
syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>[?!]\@!\)"
47+
syn keyword rubyEval eval class_eval instance_eval module_eval
48+
syn keyword rubyException raise fail catch throw
49+
" false positive with 'include?'
50+
syn match rubyInclude "\<include\>[?!]\@!"
51+
syn keyword rubyInclude autoload extend load require
52+
syn keyword rubyKeyword callcc caller lambda proc
53+
endif
54+
4055
" Expression Substitution and Backslash Notation
4156
syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
4257
syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
@@ -251,21 +266,6 @@ else
251266
syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!"
252267
endif
253268

254-
" Special Methods
255-
if !exists("ruby_no_special_methods")
256-
syn keyword rubyAccess public protected private module_function
257-
" attr is a common variable name
258-
syn match rubyAttribute "\%(\%(^\|;\)\s*\)\@<=attr\>\(\s*[.=]\)\@!"
259-
syn keyword rubyAttribute attr_accessor attr_reader attr_writer
260-
syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>[?!]\@!\)"
261-
syn keyword rubyEval eval class_eval instance_eval module_eval
262-
syn keyword rubyException raise fail catch throw
263-
" false positive with 'include?'
264-
syn match rubyInclude "\<include\>[?!]\@!"
265-
syn keyword rubyInclude autoload extend load require
266-
syn keyword rubyKeyword callcc caller lambda proc
267-
endif
268-
269269
" Comments and Documentation
270270
syn match rubySharpBang "\%^#!.*" display
271271
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE XXX contained

0 commit comments

Comments
 (0)