blob: a87d1e9a39922496a98a555149cd8f34a87d5ef7 [file] [log] [blame]
Wu, Zhenyuf9f54242024-04-14 20:38:24 +02001" the Requirements File Format syntax support for Vim
2" Version: 1.8.0
3" Author: raimon <raimon49@hotmail.com>
4" Upstream: https://github.com/raimon49/requirements.txt.vim
5" License: MIT LICENSE
6" The MIT License (MIT)
7"
8" Copyright (c) 2015 raimon
9"
10" Permission is hereby granted, free of charge, to any person obtaining a copy
11" of this software and associated documentation files (the "Software"), to deal
12" in the Software without restriction, including without limitation the rights
13" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14" copies of the Software, and to permit persons to whom the Software is
15" furnished to do so, subject to the following conditions:
16"
17" The above copyright notice and this permission notice shall be included in all
18" copies or substantial portions of the Software.
19"
20" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26" SOFTWARE.
27
28if exists("b:current_syntax") && b:current_syntax == "requirements"
29 finish
30endif
31
32syn case match
33
34" https://pip.pypa.io/en/stable/reference/requirements-file-format/
35" https://pip.pypa.io/en/stable/reference/inspect-report/#example
36syn keyword requirementsKeyword implementation_name implementation_version os_name platform_machine platform_release platform_system platform_version python_full_version platform_python_implementation python_version sys_platform contained
37syn region requirementsSubst matchgroup=requirementsSubstDelim start="\V${" end="\V}"
38syn region requirementsString matchgroup=requirementsStringDelim start=`'` skip=`\\'` end=`'`
39syn region requirementsString matchgroup=requirementsStringDelim start=`"` skip=`\\"` end=`"`
40syn match requirementsVersion "\v\d+[a-zA-Z0-9\.\-\*]*"
41syn region requirementsComment start="[ \t]*#" end="$"
42syn match requirementsCommandOption "\v^\[?--?[a-zA-Z\-]*\]?"
43syn match requirementsVersionSpecifiers "\v(\=\=\=?|\<\=?|\>\=?|\~\=|\!\=)"
44syn match requirementsPackageName "\v^([a-zA-Z0-9][a-zA-Z0-9\-_\.]*[a-zA-Z0-9])"
45syn match requirementsExtras "\v\[\S+\]"
46syn match requirementsVersionControls "\v(git\+?|hg\+|svn\+|bzr\+).*://.\S+"
47syn match requirementsURLs "\v(\@\s)?(https?|ftp|gopher)://?[^\s/$.?#].\S*"
48syn match requirementsEnvironmentMarkers "\v;\s[^#]+" contains=requirementsKeyword,requirementsVersionSpecifiers,requirementsString
49
50hi def link requirementsKeyword Keyword
51hi def link requirementsSubstDelim Delimiter
52hi def link requirementsSubst PreProc
53hi def link requirementsStringDelim Delimiter
54hi def link requirementsString String
55hi def link requirementsVersion Number
56hi def link requirementsComment Comment
57hi def link requirementsCommandOption Special
58hi def link requirementsVersionSpecifiers Boolean
59hi def link requirementsPackageName Identifier
60hi def link requirementsExtras Type
61hi def link requirementsVersionControls Underlined
62hi def link requirementsURLs Underlined
63hi def link requirementsEnvironmentMarkers Macro
64
65let b:current_syntax = "requirements"
66
67" vim: et sw=4 ts=4 sts=4: