From 77adf62906a028ae52b184d535fa6a12b4e0c2f5 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 13 Oct 2020 10:44:28 +0100 Subject: [PATCH] VIM: Adds request syntax file File was simply taken from my old Vim configuration. It inherits most of the html syntax as it is set on responses as well as requests Also, adds some request / response specific highlighting for things like http method etc. --- nvim/.config/nvim/syntax/request.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 nvim/.config/nvim/syntax/request.vim diff --git a/nvim/.config/nvim/syntax/request.vim b/nvim/.config/nvim/syntax/request.vim new file mode 100644 index 00000000..d1bb1b08 --- /dev/null +++ b/nvim/.config/nvim/syntax/request.vim @@ -0,0 +1,25 @@ +if exists("b:current_syntax") + finish +endif +runtime! syntax/html.vim +runtime! after/syntax/html.vim +let s:cpo_save = &cpo +set cpo&vim +syn keyword httpMethod OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT PATCH contained +syn match httpProto 'HTTP/[0-9.]\+' contained +syn match httpStatusCode '[0-9]\{3\}' contained +syn match httpStatus '[0-9]\{3\} .*$' contained contains=httpStatusCode +syn match httpHeaderKey '^[A-Z][A-Za-z0-9\-]*:' contained +syn match httpURILine '^\(OPTIONS\|GET\|HEAD\|POST\|PUT\|DELETE\|TRACE\|CONNECT\|PATCH\)\( .*\)\?\(HTTP/[0-9.]\+\)\?$' contains=httpMethod,httpProto contained +syn match httpResponseLine '^HTTP/[0-9.]\+ [0-9]\{3\}.*$' contains=httpProto,httpStatus contained +syn match httpHeaderLine '^[A-Z][A-Za-z0-9\-]*: .*$' contains=httpHeaderKey contained +syn region httpHeader start='^\(OPTIONS\|GET\|HEAD\|POST\|PUT\|DELETE\|TRACE\|CONNECT\|PATCH\)\( .*\)\?\(HTTP/[0-9.]\+\)\?$' end='\n\s*\n' contains=httpURILine,httpHeaderLine +syn region httpHeader start='^HTTP/[0-9.]\+ [0-9]\{3\}.*$' end='\n\s*\n' contains=httpResponseLine,httpHeaderLine +hi link httpMethod Type +hi link httpProto Statement +hi link httpHeaderKey Identifier +hi link httpStatus String +hi link httpStatusCode Number +let b:current_syntax = 'request' +let &cpo = s:cpo_save +unlet s:cpo_save