mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-23 19:12:06 +03:00
Add basic Syntax highlighting for VIM
This commit is contained in:
parent
b0ff7d9521
commit
6edd7f9852
16
contrib/vim/README.md
Normal file
16
contrib/vim/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
Install vim syntaxt highlighting for Hurl
|
||||
|
||||
```
|
||||
mkdir -p ~/.vim/{ftdetect,syntax}
|
||||
cp ftdetect/hurl.vim ~/.vim/ftdetect
|
||||
cp syntax/hurl.vim ~/.vim/syntax
|
||||
```
|
||||
|
||||
Activate syntax highlighting in your ~/.vimrc
|
||||
```
|
||||
syntax on
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
2
contrib/vim/ftdetect/hurl.vim
Normal file
2
contrib/vim/ftdetect/hurl.vim
Normal file
@ -0,0 +1,2 @@
|
||||
autocmd BufRead,BufNewFile *.hurl set filetype=hurl
|
||||
|
38
contrib/vim/syntax/hurl.vim
Normal file
38
contrib/vim/syntax/hurl.vim
Normal file
@ -0,0 +1,38 @@
|
||||
" Vim syntax file
|
||||
" Language: Hurl (https://hurl.dev)
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax match Method "^GET"
|
||||
syntax match Method "^POST"
|
||||
syntax match Method "^PUT"
|
||||
syntax match Method "^DELETE"
|
||||
syntax match Method "^CONNECT"
|
||||
syntax match Method "^OPTIONS"
|
||||
syntax match Method "^TRACE"
|
||||
syntax match Method "^PATCH"
|
||||
|
||||
syntax match Comment "#.*$"
|
||||
syntax match EscapeNumberSign "\\#"
|
||||
syntax match EscapeQuote "\\\""
|
||||
syntax match Section "\[[A-Za-z]*\]"
|
||||
syntax match Number "\s[0-9]*"
|
||||
|
||||
syntax region String start='"' end='"' contains=EscapeQuote
|
||||
syntax region String start='```' end='```'
|
||||
syntax region Json start='{' end='}'
|
||||
|
||||
|
||||
" colors
|
||||
highlight Comment ctermfg=grey
|
||||
highlight Method ctermfg=yellow
|
||||
highlight Section ctermfg=magenta
|
||||
highlight String ctermfg=green
|
||||
highlight Json ctermfg=green
|
||||
highlight Number ctermfg=lightblue
|
||||
highlight EscapeNumberSign ctermfg=white
|
||||
highlight EscapeQuote ctermfg=green
|
||||
|
||||
|
29
contrib/vim/test.hurl
Normal file
29
contrib/vim/test.hurl
Normal file
@ -0,0 +1,29 @@
|
||||
# This is a comment
|
||||
GET http://example.com
|
||||
Header1: Value1
|
||||
Header2: a\# # value with \#
|
||||
Header3: GET
|
||||
|
||||
HTTP/1.1 200
|
||||
[Asserts]
|
||||
body not contains "#" # Other comment
|
||||
body not contains "[Asserts]"
|
||||
body not contains "200"
|
||||
body not contains "GET"
|
||||
body not contains "\"\#"
|
||||
|
||||
|
||||
POST http://example.com
|
||||
{
|
||||
"id": 123,
|
||||
"message": "Hello"
|
||||
}
|
||||
|
||||
|
||||
POST http://example.com
|
||||
```
|
||||
Hello
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user