-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: better syntax highlights in http result
- Loading branch information
1 parent
3c46649
commit 5b21f91
Showing
2 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
if exists("b:current_syntax") | finish | endif | ||
|
||
syn match httpResultComment "\v^#.*$" | ||
syn keyword httpResultTitle GET POST PATCH PUT HEAD DELETE nextgroup=httpResultPath | ||
syn match httpResultPath ".*$" contained | ||
syn match httpResultField /^\(\w\)[^:]\+:/he=e-1 | ||
syn match httpResultComment "\v^#.*$" | ||
syn keyword httpResultTitle GET POST PATCH PUT HEAD DELETE nextgroup=httpResultPath | ||
syn match httpResultPat /.*$/ contained | ||
|
||
syn region httpResultString start=/\vr?"/ end=/\v"/ | ||
syn match httpResultNumber /\v([a-zA-Z_:]\d*)@<!\d+(\.(\d+)?)?/ | ||
syn match httpResultField /^\(\w\)[^:]\+:/he=e-1 | ||
syn region httpResultDateField start=+^[Dd]ate:+he=e-1 end=+ + nextgroup=httpResultDate | ||
syn region httpResultDateField start=+^[Ee]xpires:+he=e-1 end=+ + nextgroup=httpResultDate | ||
syn match httpResultDate /.*$/ contained | ||
|
||
syn region httpResultHeader start=+^HTTP/+ end=+ + nextgroup=httpResult200,httpResult300,httpResult400,httpResult500 | ||
syn match httpResult200 /2.*$/ contained | ||
syn match httpResult300 /3.*$/ contained | ||
syn match httpResult400 /4.*$/ contained | ||
syn match httpResult500 /5.*$/ contained | ||
|
||
syn include @json syntax/json.vim | ||
syn region jsonBody start="\v\{" end="\v\}$" contains=@json keepend | ||
syn region httpResultString start=/\vr?"/ end=/\v"/ | ||
syn match httpResultNumber /\v[ =]@1<=\d+[ \n]/ | ||
|
||
hi link httpResultComment Comment | ||
hi link httpResultTitle Type | ||
hi link httpResultPath Title | ||
hi link httpResultField Variable | ||
hi link httpResultString String | ||
hi link httpResultNumber Number | ||
hi link httpResultComment Comment | ||
hi link httpResultTitle Type | ||
hi link httpResultPath httpTSURI | ||
hi link httpResultField Identifier | ||
hi link httpResultDateField Identifier | ||
hi link httpResultDate String | ||
hi link httpResultString String | ||
hi link httpResultNumber Number | ||
hi link httpResultHeader Type | ||
hi link httpResult200 String | ||
hi link httpResult300 Function | ||
hi link httpResult400 Number | ||
hi link httpResult500 Number | ||
|
||
let b:current_syntax = "httpResult" |