" Vim syntax file " Language: Rails log file " Maintainer: murphy (Kornelius Kalnbach) " Last Change: 2006 March 25 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") finish endif if !exists("main_syntax") let main_syntax = 'railslog' endif if version < 600 so :p:h/html.vim syn include @rubyTop :p:h/ruby.vim else runtime! syntax/html.vim unlet b:current_syntax syn include @rubyTop syntax/ruby.vim endif syn cluster rlProcessLines contains=rlProcessLine,rlRenderingLine,rlSessionIdLine,rlParameterLine,rlCompletedInLine syn region rlProcess start="\(^Processing\>.*\n\)\@<=" end="\(^Completed in\>\)\@=" fold contains=@rlProcessLines,rlComponent " Processing MainController#index (for 127.0.0.1 at 2006-03-25 21:10:03) [GET] syn region rlProcessLine start=/^Processing\>/ end="$" contains=rlProcessTitle,rlCall,rlIP,rlTime,rlHttpMethod syn match rlProcessTitle "^Processing\>" contained syn match rlCall "\w\+\(::\w\+\)*#\w\+" contains=rlController,rlAction transparent contained syn match rlController "\w\+\(::\w\+\)*#\@=" contained syn match rlAction "#\@<=\w\+" contained syn match rlIP /\d\+\.\d\+\.\d\+\.\d\+/ contained syn match rlTime /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/ contained syn region rlHttpMethod matchgroup=rlHttpMethodBrakes start="\[" end="\]" contained " Completed in 0.48100 (2 reqs/sec) | Rendering: 0.41100 (85%) | DB: 0.03000 (6%) | 200 OK [http://localhost/] syn region rlCompletedInLine matchgroup=rlCompletedTitle start="^Completed in\>" end="$" contains=rlBenchmark,rlBenchmarkKey,rlRPS,rlBenchmarkSplitter,rlPercent,rlHttpResponse syn match rlBenchmarkKey "\u\w\+:" contained syn match rlBenchmark "\d\+\.\d\{4,}" contained syn match rlRPS "(\d\+ reqs/sec)" contains=rlRPSValue contained syn match rlRPSValue "\d\+" contained syn match rlPercent "(\d\+%)" syn match rlBenchmarkSplitter "|" contained syn match rlHttpResponse "\d\+ \w\+ \[.*\]" contains=rlHttpResponseCode,rlHttpResponseMsg,rlHttpResponseUrl contained syn match rlHttpResponseCode "\<\d\+\>" contained syn match rlHttpResponseText "\(\<\d\+\> \)\@<=.*[^\[]\+" contained syn match rlHttpResponseUrl "\[\@<=.\{-}\]\@=" contained " Start rendering component ({:action=>"index", :controller=>"menu"}): " " " Processing MenuController#index (for 127.0.0.1 at 2006-03-25 21:10:04) [GET] " Session ID: 90bcbd0ca6dd7d2e3cf9cb4beae3fd43 " Parameters: {"action"=>"index", "id"=>nil, "controller"=>"menu"} " Rendering menu/index " Completed in 0.10000 (9 reqs/sec) | Rendering: 0.10000 (100%) | DB: 0.01000 (9%) | 200 OK [http://localhost/] " " " End of component rendering " Completed in 0.48100 (2 reqs/sec) | Rendering: 0.41100 (85%) | DB: 0.03000 (6%) | 200 OK [http://localhost/] syn region rlComponent matchgroup=rlComponentStatus start="^Start rendering component\>" end="^End of component rendering$" fold contains=@rlProcessLines,rlComponentParameters contained syn region rlComponentParameters start="({" end="})" contains=@rubyTop keepend contained " Rendering menu/index syn region rlRenderingLine matchgroup=rlRenderingTitle start=/^Rendering/ end="$" contains=rlUrlController,rlUrlAction syn match rlUrlAction "/\@<=\(\w\+\)\@>/\@!" contained syn match rlUrlController "\(\w\+/\)*\w\+/\@=" contained syn match rlDataKey "\(^\s*\)\@<=.\+:" contained " Session ID: 90bcbd0ca6dd7d2e3cf9cb4beae3fd43 syn region rlSessionIdLine start="Session ID:" end="$" contains=rlDataKey,rlSessionId syn match rlSessionId "\x\{32}" contained " Parameters: {"action"=>"index", "id"=>nil, "controller"=>"menu"} syn region rlParameterLine start="Parameters:" end="$" contains=rlDataKey,rlParameters syn region rlParameters start="{" end="}" contains=@rubyTop keepend oneline contained " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_railslog_syntax_inits") if version < 508 let did_railslog_syntax_inits = 1 command -nargs=+ HiLink hi link else command -nargs=+ HiLink hi def link endif " The default methods for highlighting. Can be overridden later HiLink rlProcessLine Constant HiLink rlProcessTitle Title HiLink rlAction Action HiLink rlController Controller HiLink rlIP Function HiLink rlTime Function HiLink rlHttpMethod Constant HiLink rlHttpMethodBrakes Special HiLink rlComponentStatus Title HiLink rlCompletedTitle Constant HiLink rlBenchmark PreProc HiLink rlBenchmarkKey Type HiLink rlPercent rlRPS HiLink rlRPS Title HiLink rlRPSValue Underlined HiLink rlBenchmarkSplitter Special HiLink rlHttpResponse Special HiLink rlHttpResponseCode Function HiLink rlHttpResponseText Constant HiLink rlHttpResponseUrl Constant HiLink rlRenderingLine Constant HiLink rlRenderingTitle Constant HiLink rlUrlAction Action HiLink rlUrlController Controller HiLink rlDataKey Type HiLink rlSessionId Function HiLink rlxParameters Function HiLink Controller PreProc HiLink Action Statement delcommand HiLink endif let b:current_syntax = "railslog" if main_syntax == 'railslog' unlet main_syntax endif