diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-18 23:31:31 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-18 23:31:31 +0200 |
commit | 0df1bfa0c5f3efb6688566d5656a330034772037 (patch) | |
tree | a5c04d333061876bc3ecc2ba4b93e9043d0b8270 | |
parent | f7302d92629d29eb970c3d5fbb2f76ae6d6cf50a (diff) | |
download | vim-polyglot-4.5.0.tar.gz vim-polyglot-4.5.0.zip |
Add requirements.txt support, closes #507v4.5.0
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | autoload/requirements.vim | 36 | ||||
-rwxr-xr-x | build | 1 | ||||
-rwxr-xr-x | build.py | 1 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 7 | ||||
-rw-r--r-- | syntax/requirements.vim | 57 |
6 files changed, 104 insertions, 1 deletions
@@ -10,7 +10,7 @@ A collection of language packs for Vim. > One to rule them all, one to find them, one to bring them all and in the darkness bind them. - It **won't affect your startup time**, as scripts are loaded only on demand\*. -- It **installs and updates 120+ times faster** than the <!--Package Count-->156<!--/Package Count--> packages it consists of. +- It **installs and updates 120+ times faster** than the <!--Package Count-->157<!--/Package Count--> packages it consists of. - Solid syntax and indentation support (other features skipped). Only the best language packs. - All unnecessary files are ignored (like enormous documentation from php support). - No support for esoteric languages, only most popular ones (modern too, like `slim`). @@ -156,6 +156,7 @@ If you need full functionality of any plugin, please use it directly with your p - [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin) - [razor](https://github.com/adamclerk/vim-razor) (syntax, indent, ftplugin) - [reason](https://github.com/reasonml-editor/vim-reason-plus) (syntax, indent) +- [requirements](https://github.com/raimon49/requirements.txt.vim) (syntax, autoload) - [rspec](https://github.com/keith/rspec.vim) (syntax) - [rst](https://github.com/marshallward/vim-restructuredtext) (syntax, indent, autoload, ftplugin) - [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin) diff --git a/autoload/requirements.vim b/autoload/requirements.vim new file mode 100644 index 00000000..f237905e --- /dev/null +++ b/autoload/requirements.vim @@ -0,0 +1,36 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'requirements') == -1 + +" the Requirements File Format syntax support for Vim +" Version: 1.5.3 +" Author: raimon <raimon49@hotmail.com> +" License: MIT LICENSE +" The MIT License (MIT) +" +" Copyright (c) 2015 raimon +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to deal +" in the Software without restriction, including without limitation the rights +" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +" copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in all +" copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +" SOFTWARE. + +let s:save_cpo = &cpo +set cpo&vim + +let &cpo = s:save_cpo +unlet s:save_cpo +" vim: et sw=4 ts=4 sts=4: + +endif @@ -250,6 +250,7 @@ PACKS=" raml:IN3D/vim-raml razor:adamclerk/vim-razor reason:reasonml-editor/vim-reason-plus + requirements:raimon49/requirements.txt.vim rspec:keith/rspec.vim rst:marshallward/vim-restructuredtext ruby:vim-ruby/vim-ruby @@ -257,6 +257,7 @@ language("Jsonnet") language("Fennel", extensions=[".fnl"]) language("mcfunction") language("JSONiq", extra_filenames=[".jqrc"], filetype="jq", polyglot="jq") +language("Requirements", extensions=[".pip"], filenames=["*requirements.{txt,in}", "*require.{txt,in}", "constraints.{txt,in}"]) lines.append('" restore Vi compatibility settings') lines.append('let &cpo = s:cpo_save') diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 24b77afb..c069703f 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -1160,6 +1160,13 @@ if index(g:polyglot_disabled, 'jq') == -1 au BufNewFile,BufRead {.,}jqrc set ft=jq endif +if index(g:polyglot_disabled, 'requirements') == -1 + au BufNewFile,BufRead *.pip set ft=requirements + au BufNewFile,BufRead *require.{txt,in} set ft=requirements + au BufNewFile,BufRead *requirements.{txt,in} set ft=requirements + au BufNewFile,BufRead constraints.{txt,in} set ft=requirements +endif + " restore Vi compatibility settings let &cpo = s:cpo_save unlet s:cpo_save
\ No newline at end of file diff --git a/syntax/requirements.vim b/syntax/requirements.vim new file mode 100644 index 00000000..e9392815 --- /dev/null +++ b/syntax/requirements.vim @@ -0,0 +1,57 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'requirements') == -1 + +" the Requirements File Format syntax support for Vim +" Version: 1.5.3 +" Author: raimon <raimon49@hotmail.com> +" License: MIT LICENSE +" The MIT License (MIT) +" +" Copyright (c) 2015 raimon +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to deal +" in the Software without restriction, including without limitation the rights +" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +" copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in all +" copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +" SOFTWARE. + +if exists("b:current_syntax") && b:current_syntax == "requirements" + finish +endif + +syn case match + +syn region requirementsComment start="[ \t]*#" end="$" +syn match requirementsCommandOption "\v^\[?--?[a-zA-Z\-]*\]?" +syn match requirementsVersionSpecifiers "\v(\=\=\=?|\<\=?|\>\=?|\~\=|\!\=)" +syn match requirementsPackageName "\v^([a-zA-Z0-9][a-zA-Z0-9\-_\.]*[a-zA-Z0-9])" +syn match requirementsExtras "\v\[\S+\]" +syn match requirementsVersionControls "\v(git\+?|hg\+|svn\+|bzr\+).*://.\S+" +syn match requirementsURLs "\v(\@\s)?(https?|ftp|gopher)://?[^\s/$.?#].\S*" +syn match requirementsEnvironmentMarkers "\v;\s[^#]+" + +hi link requirementsComment Comment +hi link requirementsCommandOption Special +hi link requirementsVersionSpecifiers Boolean +hi link requirementsPackageName Identifier +hi link requirementsExtras Type +hi link requirementsVersionControls Underlined +hi link requirementsURLs Underlined +hi link requirementsEnvironmentMarkers Macro + +let b:current_syntax = "requirements" + +" vim: et sw=4 ts=4 sts=4: + +endif |