1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 12:39:09 +08:00

feat(layer): add lang#jsonnet layer

This commit is contained in:
wsdjeg 2022-05-08 19:01:53 +08:00
parent d95368b008
commit a7db14e865
16 changed files with 850 additions and 69 deletions

View File

@ -0,0 +1,25 @@
"=============================================================================
" jsonnet.vim --- jsonnet support for vim
" Copyright (c) 2016-2019 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg@outlook.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
""
" @section lang#jsonnet, layers-lang-jsonnet
" @parentsection layers
" This layer adds syntax highlighting for the jsonnet Language.
" It is disabled by default, to enable this layer, add following snippet to your
" SpaceVim configuration file.
" >
" [[layers]]
" name = 'lang#jsonnet'
" <
"
function! SpaceVim#layers#lang#jsonnet#plugins() abort
let plugins = []
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-jsonnet', {'merged' : 0}])
return plugins
endfunction

2
bundle/vim-jsonnet/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*~
.*.swp

View File

@ -0,0 +1,4 @@
Before we can merge your pull request, we need you to sign either the Google individual or corporate
contributor license agreement (CLA), unless you are a Google employee, intern, or contractor.
Please see http://google.github.io/jsonnet/doc/contributing.html for more information.

202
bundle/vim-jsonnet/LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,35 @@
# vim-jsonnet
[Jsonnet][jsonnet] filetype plugin for Vim.
[jsonnet]: http://jsonnet.org
![A screenshot of Jsonnet syntax highlighting](https://raw.githubusercontent.com/google/vim-jsonnet/master/jsonnet-screenshot.png)
# Install
To install via Vim plugin managers:
### Vundle
```viml
Plugin 'google/vim-jsonnet'
```
### vim-plug
```viml
Plug 'google/vim-jsonnet'
```
### Pathogen
```sh
git clone https://github.com/google/vim-jsonnet ~/.vim/bundle/vim-jsonnet
```
## More Info
For more info on Jsonnet:
* Jsonnet Website: http://jsonnet.org
* Jsonnet Repository: https://github.com/google/jsonnet

View File

@ -0,0 +1,125 @@
" Options.
if !exists("g:jsonnet_command")
let g:jsonnet_command = "jsonnet"
endif
if !exists("g:jsonnet_fmt_command")
let g:jsonnet_fmt_command = "jsonnetfmt"
endif
if !exists('g:jsonnet_fmt_options')
let g:jsonnet_fmt_options = ''
endif
if !exists('g:jsonnet_fmt_fail_silently')
let g:jsonnet_fmt_fail_silently = 1
endif
" System runs a shell command. It will reset the shell to /bin/sh for Unix-like
" systems if it is executable.
function! jsonnet#System(str, ...)
let l:shell = &shell
if executable('/bin/sh')
let &shell = '/bin/sh'
endif
try
let l:output = call("system", [a:str] + a:000)
return l:output
finally
let &shell = l:shell
endtry
endfunction
" CheckBinPath checks whether the given binary exists or not and returns the
" path of the binary. It returns an empty string if it doesn't exists.
function! jsonnet#CheckBinPath(binName)
if executable(a:binName)
if exists('*exepath')
let binPath = exepath(a:binName)
return binPath
else
return a:binName
endif
else
echo "vim-jsonnet: could not find '" . a:binName . "'."
return ""
endif
endfunction
" Format calls `jsonnetfmt ... ` on the file and replaces the file with the
" auto formatted version. Does some primitive error checking of the
" jsonnetfmt command too.
function! jsonnet#Format()
" Save cursor position and many other things.
let l:curw = winsaveview()
" Write current unsaved buffer to a temp file
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
" get the command first so we can test it
let l:binName = g:jsonnet_fmt_command
" check if the user has installed command binary.
let l:binPath = jsonnet#CheckBinPath(l:binName)
if empty(l:binPath)
return
endif
" Populate the final command.
let l:command = l:binPath
" The inplace modification is default. Makes file management easier
let l:command = l:command . ' -i '
let l:command = l:command . g:jsonnet_fmt_options
" Execute the compiled jsonnetfmt command and save the return value
let l:out = jsonnet#System(l:command . " " . l:tmpname)
let l:errorCode = v:shell_error
if l:errorCode == 0
" The format command succeeded Move the formatted temp file over the
" current file and restore other settings
" stop undo recording
try | silent undojoin | catch | endtry
let l:originalFileFormat = &fileformat
if exists("*getfperm")
" save old file permissions
let l:originalFPerm = getfperm(expand('%'))
endif
" Overwrite current file with the formatted temp file
call rename(l:tmpname, expand('%'))
if exists("*setfperm") && l:originalFPerm != ''
call setfperm(expand('%'), l:originalFPerm)
endif
" the file has been changed outside of vim, enable reedit
silent edit!
let &fileformat = l:originalFileFormat
let &syntax = &syntax
elseif g:jsonnet_fmt_fail_silently == 0
" FixMe: We could leverage the errors coming from the `jsonnetfmt` and
" give immediate feedback to the user at every save time.
" Our inspiration, vim-go, opens a new list below the current edit
" window and shows the errors (the output of the fmt command).
" We are not sure whether this is desired in the vim-jsonnet community
" or not. Nevertheless, this else block is a suitable place to benefit
" from the `jsonnetfmt` errors.
endif
" Restore our cursor/windows positions.
call winrestview(l:curw)
endfunction

View File

@ -0,0 +1,100 @@
*vim-jsonnet.txt* Jsonnet development plugin
*vim-jsonnet*
====================================================================================
# # ### # # # ##### ####### # # # # ####### #######
# # # ## ## # # # # # ## # ## # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # ##### # ##### # # # # # # # # ##### #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # ## # ## # #
# ### # # ##### ##### ####### # # # # ####### #
====================================================================================
CONTENTS *jsonnet-contents*
1. Intro........................................|jsonnet-intro|
2. Install......................................|jsonnet-install|
3. Commands.....................................|jsonnet-commands|
4. Mappings.....................................|jsonnet-mappings|
6. Functions....................................|jsonnet-functions|
7. Settings.....................................|jsonnet-settings|
8. Troubleshooting..............................|jsonnet-troubleshooting|
9. Credits......................................|jsonnet-credits|
==============================================================================
INTRO *jsonnet-intro*
==============================================================================
INSTALL *jsonnet-install*
==============================================================================
COMMANDS *jsonnet-commands*
*:JsonnetFmt*
:JsonnetFmt
Filter the current Jsonnet buffer through `jsonnetfmt`. It tries to
preserve cursor position and avoids replacing the buffer with stderr
output.
==============================================================================
MAPPINGS *jsonnet-mappings*
==============================================================================
FUNCTIONS *jsonnet-functions*
*jsonnet#Format()*
Filter the current Jsonnet buffer through `jsonnetfmt`. It tries to
preserve cursor position and avoids replacing the buffer with stderr
output.
==============================================================================
SETTINGS *jsonnet-settings*
*'g:jsonnet_fmt_on_save'*
Use this option to auto |:JsonnetFmt| on save. By default it's enabled >
let g:jsonnet_fmt_on_save = 1
<
*'g:jsonnet_command'*
Use this option to define which tool is used to fotmat. By default `jsonnet` is
used >
let g:jsonnet_command = "jsonnet"
<
*'g:jsonnet_fmt_command'*
Use this option to define which <cmd> parameter is used with *g:jsonnet_command* tool.
By default `fmt` is used >
let g:jsonnet_fmt_command = "fmt"
<
*'g:jsonnet_fmt_options'*
Use this option to add additional options to the
|'g:jsonnet_command'| + |'g:jsonnet_fmt_command'|. Default is empty. >
let g:jsonnet_fmt_options = ''
<
*'g:jsonnet_fmt_fail_silently'*
Use this option to enable processing of
|'g:jsonnet_command'| + |'g:jsonnet_fmt_command'| command if it fails. By default
it is turned off. By default the error output from the
|'g:jsonnet_command'| + |'g:jsonnet_fmt_command'| command is ignored.
FixMe: The processing of the |'g:jsonnet_command'| + |'g:jsonnet_fmt_command'|
is not implemented yet. So clearing this option would not do anything at this time. >
let g:jsonnet_fmt_fail_silently = 1
<
==============================================================================
TROUBLESHOOTING *jsonnet-troubleshooting*
==============================================================================
CREDITS *jsonnet-credits*

View File

@ -0,0 +1,16 @@
" Copyright 2014 Google Inc. All rights reserved.
"
" Licensed under the Apache License, Version 2.0 (the "License");
" you may not use this file except in compliance with the License.
" You may obtain a copy of the License at
"
" http://www.apache.org/licenses/LICENSE-2.0
"
" Unless required by applicable law or agreed to in writing, software
" distributed under the License is distributed on an "AS IS" BASIS,
" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
" See the License for the specific language governing permissions and
" limitations under the License.
autocmd BufNewFile,BufRead *.jsonnet setf jsonnet
autocmd BufNewFile,BufRead *.libsonnet setf jsonnet

View File

@ -0,0 +1,9 @@
" -- fmt
command! -nargs=0 JsonnetFmt call jsonnet#Format()
setlocal commentstring=//\ %s

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,31 @@
" A plugin for jsonnet files.
" Install useful tools for *.jsonnet and *.libsonnet files
function! s:fmtAutosave()
" Jsonnet code formatting on save
if get(g:, "jsonnet_fmt_on_save", 1)
call jsonnet#Format()
endif
endfunction
" auto group and clear inside prevents multiple registration of the same
" auto commands
augroup vim-jsonnet
autocmd!
autocmd BufReadPre *.jsonnet setlocal foldmethod=syntax
autocmd BufReadPre *.libsonnet setlocal foldmethod=syntax
autocmd BufReadPre *.jsonnet setlocal foldlevel=100
autocmd BufReadPre *.libsonnet setlocal foldlevel=100
autocmd BufWritePre *.jsonnet call s:fmtAutosave()
autocmd BufWritePre *.libsonnet call s:fmtAutosave()
augroup END

View File

@ -0,0 +1,134 @@
" Copyright 2014 Google Inc. All rights reserved.
"
" Licensed under the Apache License, Version 2.0 (the "License");
" you may not use this file except in compliance with the License.
" You may obtain a copy of the License at
"
" http://www.apache.org/licenses/LICENSE-2.0
"
" Unless required by applicable law or agreed to in writing, software
" distributed under the License is distributed on an "AS IS" BASIS,
" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
" See the License for the specific language governing permissions and
" limitations under the License.
syntax match Number "\<\d*\([Ee][+-]\?\d\+\)\?\>"
syntax match Number "\<\d\+[.]\d*\([Ee][+-]\?\d\+\)\?\>"
syntax match Number "\<[.]\d\+\([Ee][+-]\?\d\+\)\?\>"
" builtins
syn match Constant "std.acos"
syn match Constant "std.asin"
syn match Constant "std.atan"
syn match Constant "std.ceil"
syn match Constant "std.char"
syn match Constant "std.codepoint"
syn match Constant "std.cos"
syn match Constant "std.exp"
syn match Constant "std.exponent"
syn match Constant "std.extVar"
syn match Constant "std.filter"
syn match Constant "std.floor"
syn match Constant "std.force"
syn match Constant "std.length"
syn match Constant "std.log"
syn match Constant "std.makeArray"
syn match Constant "std.mantissa"
syn match Constant "std.md5"
syn match Constant "std.modulo"
syn match Constant "std.native"
syn match Constant "std.objectFieldsEx"
syn match Constant "std.objectHasEx"
syn match Constant "std.pow"
syn match Constant "std.primitiveEquals"
syn match Constant "std.sin"
syn match Constant "std.sqrt"
syn match Constant "std.tan"
syn match Constant "std.thisFile"
syn match Constant "std.type"
" std.jsonnet
syn match Constant "std.abs"
syn match Constant "std.asciiLower"
syn match Constant "std.asciiUpper"
syn match Constant "std.assertEqual"
syn match Constant "std.base64"
syn match Constant "std.base64Decode"
syn match Constant "std.base64DecodeBytes"
syn match Constant "std.count"
syn match Constant "std.endsWith"
syn match Constant "std.equals"
syn match Constant "std.escapeStringBash"
syn match Constant "std.escapeStringDollars"
syn match Constant "std.escapeStringJson"
syn match Constant "std.escapeStringPython"
syn match Constant "std.filterMap"
syn match Constant "std.flattenArrays"
syn match Constant "std.foldl"
syn match Constant "std.foldr"
syn match Constant "std.format"
syn match Constant "std.join"
syn match Constant "std.lines"
syn match Constant "std.manifestIni"
syn match Constant "std.manifestJson"
syn match Constant "std.manifestJsonEx"
syn match Constant "std.manifestPython"
syn match Constant "std.manifestPythonVars"
syn match Constant "std.manifestYamlStream"
syn match Constant "std.map"
syn match Constant "std.mapWithIndex"
syn match Constant "std.max"
syn match Constant "std.mergePatch"
syn match Constant "std.min"
syn match Constant "std.mod"
syn match Constant "std.objectFields"
syn match Constant "std.objectFieldsAll"
syn match Constant "std.objectHas"
syn match Constant "std.objectHasAll"
syn match Constant "std.parseInt"
syn match Constant "std.prune"
syn match Constant "std.range"
syn match Constant "std.resolvePath"
syn match Constant "std.set"
syn match Constant "std.setDiff"
syn match Constant "std.setInter"
syn match Constant "std.setMember"
syn match Constant "std.setUnion"
syn match Constant "std.slice"
syn match Constant "std.sort"
syn match Constant "std.split"
syn match Constant "std.splitLimit"
syn match Constant "std.startsWith"
syn match Constant "std.stringChars"
syn match Constant "std.strReplace"
syn match Constant "std.substr"
syn match Constant "std.toString"
syn match Constant "std.uniq"
syn match Type "\$"
syn region String start='L\="' skip='\\\\\|\\"' end='"'
syn region String start='L\=\'' skip='\\\\\|\\\'' end='\''
syn region String start='|||\s*\n\+\z(\s*\)' end='^\z1\@!\s*|||'
" Highlight python style string formatting.
syn match Special "%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=String
syn match Special "%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=String
syn region Comment start="/[*]" end="[*]/"
syn match Comment "//.*$"
syn match Comment "#.*$"
syn match Keyword "\<[a-zA-Z_][a-z0-9A-Z_]*\s*\(([^)]*)\)\?\s*+\?::\?:\?"
syn region Object start="{" end="}" fold transparent
syntax keyword Include import importstr
syntax keyword Type function self super
syntax keyword Statement assert if then else for in
syntax keyword Special local tailstrict
syntax keyword Constant true false null
syntax keyword Underlined error

View File

@ -0,0 +1,45 @@
" Vim syntastic plugin
" Language: jsonnet
" Author: Benjamin Staffin <benley@gmail.com>
"
" For details on how to add an external Syntastic checker:
" https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external
if exists("g:loaded_syntastic_jsonnet_jsonnet_checker")
finish
endif
let g:loaded_syntastic_jsonnet_jsonnet_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_jsonnet_jsonnet_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_jsonnet_jsonnet_GetLocList() dict
let errorformat =
\ 'STATIC ERROR:\ %f:%l:%c:%m,' .
\ 'STATIC ERROR:\ %f:%l:%c-%\d%#:%m,' .
\ '%ERUNTIME ERROR:\ %m,' .
\ '%C\ %#%f:(%\?%l:%c)%\?%.%#'
return SyntasticMake({
\ 'makeprg': self.makeprgBuild({}),
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'jsonnet',
\ 'name': 'jsonnet'})
" Register for syntastic tab completion:
if exists('g:syntastic_extra_filetypes')
call add(g:syntastic_extra_filetypes, 'jsonnet')
else
let g:syntastic_extra_filetypes = ['jsonnet']
endif
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -163,72 +163,73 @@ CONTENTS *SpaceVim-contents*
68. lang#javascript....................|SpaceVim-layers-lang-javascript|
69. lang#jr....................................|SpaceVim-layers-lang-jr|
70. lang#json................................|SpaceVim-layers-lang-json|
71. lang#julia..............................|SpaceVim-layers-lang-julia|
72. lang#kotlin............................|SpaceVim-layers-lang-kotlin|
73. lang#latex..............................|SpaceVim-layers-lang-latex|
74. lang#lisp................................|SpaceVim-layers-lang-lisp|
75. lang#livescript....................|SpaceVim-layers-lang-livescript|
76. lang#lua..................................|SpaceVim-layers-lang-lua|
77. lang#markdown........................|SpaceVim-layers-lang-markdown|
78. lang#moonscript....................|SpaceVim-layers-lang-moonscript|
79. lang#nim..................................|SpaceVim-layers-lang-nim|
80. lang#nix..................................|SpaceVim-layers-lang-nix|
81. lang#ocaml..............................|SpaceVim-layers-lang-ocaml|
82. lang#octave............................|SpaceVim-layers-lang-octave|
83. lang#pact................................|SpaceVim-layers-lang-pact|
84. lang#pascal............................|SpaceVim-layers-lang-pascal|
85. lang#perl................................|SpaceVim-layers-lang-perl|
86. lang#php..................................|SpaceVim-layers-lang-php|
87. lang#plantuml........................|SpaceVim-layers-lang-plantuml|
88. lang#pony................................|SpaceVim-layers-lang-pony|
89. lang#processing....................|SpaceVim-layers-lang-processing|
90. lang#prolog............................|SpaceVim-layers-lang-prolog|
91. lang#puppet............................|SpaceVim-layers-lang-puppet|
92. lang#purescript....................|SpaceVim-layers-lang-purescript|
93. lang#python............................|SpaceVim-layers-lang-python|
94. lang#racket............................|SpaceVim-layers-lang-racket|
95. lang#racket...............................|SpaceVim-layers-lang-red|
96. lang#reason............................|SpaceVim-layers-lang-reason|
97. lang#ring...................................|SpaceVim-layers-lang-r|
98. lang#ring................................|SpaceVim-layers-lang-ring|
99. lang#ruby................................|SpaceVim-layers-lang-ruby|
100. lang#rust...............................|SpaceVim-layers-lang-rust|
101. lang#scala.............................|SpaceVim-layers-lang-scala|
102. lang#scheme...........................|SpaceVim-layers-lang-scheme|
103. lang#sh...................................|SpaceVim-layers-lang-sh|
104. lang#smalltalk.....................|SpaceVim-layers-lang-smalltalk|
105. lang#sml.................................|SpaceVim-layers-lang-sml|
106. lang#swig..............................|SpaceVim-layers-lang-swift|
107. lang#swig...............................|SpaceVim-layers-lang-swig|
108. lang#tcl.................................|SpaceVim-layers-lang-tcl|
109. lang#teal...............................|SpaceVim-layers-lang-teal|
110. lang#toml...............................|SpaceVim-layers-lang-toml|
111. lang#typescript...................|SpaceVim-layers-lang-typescript|
112. lang#v.....................................|SpaceVim-layers-lang-v|
113. lang#vala...............................|SpaceVim-layers-lang-vala|
114. lang#vbnet.............................|SpaceVim-layers-lang-vbnet|
115. lang#verilog.........................|SpaceVim-layers-lang-verilog|
116. lang#vim.................................|SpaceVim-layers-lang-vim|
117. lang#vue.................................|SpaceVim-layers-lang-vue|
118. lang#wdl.................................|SpaceVim-layers-lang-wdl|
119. lang#wolfram.........................|SpaceVim-layers-lang-wolfram|
120. lang#xml.................................|SpaceVim-layers-lang-xml|
121. lang#xquery...........................|SpaceVim-layers-lang-xquery|
122. lang#zig.................................|SpaceVim-layers-lang-zig|
123. language server protocol......................|SpaceVim-layers-lsp|
124. leaderf...................................|SpaceVim-layers-leaderf|
125. mail.........................................|SpaceVim-layers-mail|
126. operator.................................|SpaceVim-layers-operator|
127. shell.......................................|SpaceVim-layers-shell|
128. ssh...........................................|SpaceVim-layers-ssh|
129. test.........................................|SpaceVim-layers-test|
130. tmux.........................................|SpaceVim-layers-tmux|
131. tools#dash.............................|SpaceVim-layers-tools-dash|
132. tools#mpv...............................|SpaceVim-layers-tools-mpv|
133. tools#zeal.............................|SpaceVim-layers-tools-zeal|
134. treesitter.............................|SpaceVim-layers-treesitter|
135. ui.............................................|SpaceVim-layers-ui|
136. unite.......................................|SpaceVim-layers-unite|
71. lang#jsonnet..........................|SpaceVim-layers-lang-jsonnet|
72. lang#julia..............................|SpaceVim-layers-lang-julia|
73. lang#kotlin............................|SpaceVim-layers-lang-kotlin|
74. lang#latex..............................|SpaceVim-layers-lang-latex|
75. lang#lisp................................|SpaceVim-layers-lang-lisp|
76. lang#livescript....................|SpaceVim-layers-lang-livescript|
77. lang#lua..................................|SpaceVim-layers-lang-lua|
78. lang#markdown........................|SpaceVim-layers-lang-markdown|
79. lang#moonscript....................|SpaceVim-layers-lang-moonscript|
80. lang#nim..................................|SpaceVim-layers-lang-nim|
81. lang#nix..................................|SpaceVim-layers-lang-nix|
82. lang#ocaml..............................|SpaceVim-layers-lang-ocaml|
83. lang#octave............................|SpaceVim-layers-lang-octave|
84. lang#pact................................|SpaceVim-layers-lang-pact|
85. lang#pascal............................|SpaceVim-layers-lang-pascal|
86. lang#perl................................|SpaceVim-layers-lang-perl|
87. lang#php..................................|SpaceVim-layers-lang-php|
88. lang#plantuml........................|SpaceVim-layers-lang-plantuml|
89. lang#pony................................|SpaceVim-layers-lang-pony|
90. lang#processing....................|SpaceVim-layers-lang-processing|
91. lang#prolog............................|SpaceVim-layers-lang-prolog|
92. lang#puppet............................|SpaceVim-layers-lang-puppet|
93. lang#purescript....................|SpaceVim-layers-lang-purescript|
94. lang#python............................|SpaceVim-layers-lang-python|
95. lang#racket............................|SpaceVim-layers-lang-racket|
96. lang#racket...............................|SpaceVim-layers-lang-red|
97. lang#reason............................|SpaceVim-layers-lang-reason|
98. lang#ring...................................|SpaceVim-layers-lang-r|
99. lang#ring................................|SpaceVim-layers-lang-ring|
100. lang#ruby...............................|SpaceVim-layers-lang-ruby|
101. lang#rust...............................|SpaceVim-layers-lang-rust|
102. lang#scala.............................|SpaceVim-layers-lang-scala|
103. lang#scheme...........................|SpaceVim-layers-lang-scheme|
104. lang#sh...................................|SpaceVim-layers-lang-sh|
105. lang#smalltalk.....................|SpaceVim-layers-lang-smalltalk|
106. lang#sml.................................|SpaceVim-layers-lang-sml|
107. lang#swig..............................|SpaceVim-layers-lang-swift|
108. lang#swig...............................|SpaceVim-layers-lang-swig|
109. lang#tcl.................................|SpaceVim-layers-lang-tcl|
110. lang#teal...............................|SpaceVim-layers-lang-teal|
111. lang#toml...............................|SpaceVim-layers-lang-toml|
112. lang#typescript...................|SpaceVim-layers-lang-typescript|
113. lang#v.....................................|SpaceVim-layers-lang-v|
114. lang#vala...............................|SpaceVim-layers-lang-vala|
115. lang#vbnet.............................|SpaceVim-layers-lang-vbnet|
116. lang#verilog.........................|SpaceVim-layers-lang-verilog|
117. lang#vim.................................|SpaceVim-layers-lang-vim|
118. lang#vue.................................|SpaceVim-layers-lang-vue|
119. lang#wdl.................................|SpaceVim-layers-lang-wdl|
120. lang#wolfram.........................|SpaceVim-layers-lang-wolfram|
121. lang#xml.................................|SpaceVim-layers-lang-xml|
122. lang#xquery...........................|SpaceVim-layers-lang-xquery|
123. lang#zig.................................|SpaceVim-layers-lang-zig|
124. language server protocol......................|SpaceVim-layers-lsp|
125. leaderf...................................|SpaceVim-layers-leaderf|
126. mail.........................................|SpaceVim-layers-mail|
127. operator.................................|SpaceVim-layers-operator|
128. shell.......................................|SpaceVim-layers-shell|
129. ssh...........................................|SpaceVim-layers-ssh|
130. test.........................................|SpaceVim-layers-test|
131. tmux.........................................|SpaceVim-layers-tmux|
132. tools#dash.............................|SpaceVim-layers-tools-dash|
133. tools#mpv...............................|SpaceVim-layers-tools-mpv|
134. tools#zeal.............................|SpaceVim-layers-tools-zeal|
135. treesitter.............................|SpaceVim-layers-treesitter|
136. ui.............................................|SpaceVim-layers-ui|
137. unite.......................................|SpaceVim-layers-unite|
7. Usage....................................................|SpaceVim-usage|
1. alternate file........................|SpaceVim-usage-alternate-file|
2. buffers-and-files..................|SpaceVim-usage-buffers-and-files|
@ -3602,6 +3603,18 @@ OPTIONS
concealcursor = ''
<
==============================================================================
LANG#JSONNET *SpaceVim-layers-lang-jsonnet*
This layer adds syntax highlighting for the jsonnet Language. It is disabled
by default, to enable this layer, add following snippet to your SpaceVim
configuration file.
>
[[layers]]
name = 'lang#jsonnet'
<
==============================================================================
LANG#JULIA *SpaceVim-layers-lang-julia*

View File

@ -67,7 +67,7 @@ Some layers are enabled by default. The following example shows how to disable `
| Name | Description |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [autocomplete](autocomplete/) | Autocomplete code within SpaceVim, fuzzy find the candidates from multiple completion sources, expand snippet before cursor automatically |
| [chat](chat/) | SpaceVim chatting layer provides chatting with weixin in vim. |
| [chat](chat/) | SpaceVim chatting layer provides chatting with weixin in vim. |
| [checkers](checkers/) | Syntax checking automatically within SpaceVim, display error on the sign column and statusline. |
| [chinese](chinese/) | Layer for chinese users, include chinese docs and runtime messages |
| [colorscheme](colorscheme/) | colorscheme provides a list of colorschemes for SpaceVim, the default colorscheme is gruvbox with dark theme. |
@ -79,12 +79,14 @@ Some layers are enabled by default. The following example shows how to disable `
| [ctrlp](ctrlp/) | This layers provide a heavily customized ctrlp centric work-flow |
| [ctrlspace](ctrlspace/) | This layer provides a customized CtrlSpace centric workflow |
| [debug](debug/) | This layer provides debug workflow support in SpaceVim |
| [default](default/) | SpaceVim's default layer contains no plugins, but it provides some better default config for SpaceVim. |
| [default](default/) | SpaceVim's default layer contains no plugins, but It provides some better default config for SpaceVim. |
| [denite](denite/) | This layers provide's a heavily customized Denite centric workflow |
| [edit](edit/) | Improve code edit experience in SpaceVim, provides more text objects. |
| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. |
| [foldsearch](foldsearch/) | This layer provides functions that fold away lines that don't match a specific search pattern. |
| [format](format/) | Code formatting layer for SpaceVim, includes a variety of formatters for many filetypes |
| [fzf](fzf/) | This layer provides a heavily customized fzf centric workflow |
| [git](git/) | This layer adds extensive support for git |
| [github](github/) | This layer provides GitHub integration for SpaceVim |
| [gtags](gtags/) | This layer provides gtags manager for project |
| [japanese](japanese/) | Layer for japanese users, includes japanese docs and runtime messages |
@ -96,7 +98,7 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#autohotkey](lang/autohotkey/) | This layer adds AutohotKey language support to SpaceVim. |
| [lang#batch](lang/batch/) | This layer is for DOS batch file development, provides syntax highlighting, code runner and repl support for batch files. |
| [lang#c](lang/c/) | C/C++/Object-C language support for SpaceVim, including code completion, jump to definition, and quick runner. |
| [lang#chapel](lang/chapel/) | This layer is for chapel development, provides syntax checking, code runner and repl support for chapel files. |
| [lang#chapel](lang/chapel/) | This layer is for chapel development. provides syntax checking, code runner and repl support for chapel files. |
| [lang#clojure](lang/clojure/) | This layer is for Clojure development, provides autocompletion, syntax checking, code format for Clojure files. |
| [lang#coffeescript](lang/coffeescript/) | This layer is for CoffeeScript development, provides autocompletion, syntax checking, code format for CoffeeScript files. |
| [lang#crystal](lang/crystal/) | This layer is for crystal development, provides syntax checking, code runner and repl support for crystal files. |
@ -122,6 +124,7 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#groovy](lang/groovy/) | This layer is for Groovy development, provides syntax checking, code runner and repl support for groovy files. |
| [lang#hack](lang/hack/) | This layer is for hack development, provides syntax checking, code runner and repl support for hack files. |
| [lang#haskell](lang/haskell/) | Haskell language support for SpaceVim, includes code completion, syntax checking, jumping to definition, also provides language server protocol support for Haskell |
| [lang#haxe](lang/haxe/) | This layer is for haxe development, provides syntax checking, code runner for haxe files. |
| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. |
| [lang#hy](lang/hy/) | This layer is for hy development, provides syntax checking, code runner and repl support for hy files. |
| [lang#idris](lang/idris/) | This layer is for idris development, provides syntax checking, code runner and repl support for idris files. |
@ -131,6 +134,7 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#janet](lang/janet/) | This layer is for janet development, provides code runner and repl support for janet files. |
| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. |
| [lang#javascript](lang/javascript/) | This layer provides JavaScript development support for SpaceVim, including code completion, syntax highlighting and syntax checking |
| [lang#jsonnet](lang/jsonnet/) | jsonnet language support, include syntax highlighting. |
| [lang#julia](lang/julia/) | This layer is for Julia development, provides autocompletion, syntax checking and code formatting |
| [lang#kotlin](lang/kotlin/) | This layer adds Kotlin language support to SpaceVim, including syntax highlighting, code runner and REPL support. |
| [lang#lasso](lang/lasso/) | Lasso language support, include syntax highlighting. |
@ -143,6 +147,11 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#moonscript](lang/moonscript/) | This layer is for moonscript development, provides syntax checking, code runner and repl support for moonscript files. |
| [lang#nim](lang/nim/) | This layer adds Nim language support to SpaceVim |
| [lang#nix](lang/nix/) | This layer adds Nix language support to SpaceVim. |
| [lang#ocaml](lang/ocaml/) | This layer is for OCaml development, provides autocompletion, syntax checking, and code formatting for OCaml files. |
| [lang#org](lang/org/) | Edit org file within vim, autopreview org in the default browser, with this layer you can also format org file. |
| [lang#pact](lang/pact/) | This layer is for pact development, provides syntax checking, code runner and repl support for pact files. |
| [lang#pascal](lang/pascal/) | This layer is for pascal development, provides syntax highlighting, and code runner for pascal files. |
| [lang#perl](lang/perl/) | This layer is for Perl development, provides autocompletion, syntax checking, and code formatting for Perl files. |
| [lang#php](lang/php/) | PHP language support, including code completion, syntax lint and code runner |
| [lang#plantuml](lang/plantuml/) | This layer is for PlantUML development, provides syntax highlighting for PlantUML files. |
| [lang#pony](lang/pony/) | This layer is for pony development, provides syntax checking, code runner and repl support for pony files. |
@ -170,10 +179,12 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#sml](lang/sml/) | This layer is for Standard ML development, provides syntax highlighting and repl support for sml files. |
| [lang#swift](lang/swift/) | swift language support for SpaceVim, includes code completion and syntax highlighting |
| [lang#tcl](lang/tcl/) | This layer is for Tcl development, provides syntax checking, code runner and repl support for tcl files. |
| [lang#teal](lang/teal/) | This layer is for teal development, provides syntax checking, code runner and repl support for teal files. |
| [lang#toml](lang/toml/) | This layer is for toml development, provides syntax checking, indentation, etc. |
| [lang#typescript](lang/typescript/) | This layer is for TypeScript development, including code completion, Syntax lint, and doc generation. |
| [lang#v](lang/v/) | This layer is for v development, provides syntax checking, code runner and repl support for v files. |
| [lang#vbnet](lang/vbnet/) | This layer is for Visual Basic .NET development, provides code runner for vb files. |
| [lang#verilog](lang/verilog/) | This layer is for verilog development, provides syntax checking, code runner and repl support for verilog files. |
| [lang#vim](lang/vim/) | This layer is for writing Vimscript, including code completion, syntax checking and buffer formatting |
| [lang#vue](lang/vue/) | This layer adds Vue language support to SpaceVim |
| [lang#WebAssembly](lang/WebAssembly/) | This layer adds WebAssembly support to SpaceVim |
@ -182,6 +193,7 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#zig](lang/zig/) | This layer is for zig development, provides code runner support for zig files. |
| [language-server-protocol](language-server-protocol/) | This layers provides language server protocol for vim and neovim |
| [leaderf](leaderf/) | This layer provides a heavily customized LeaderF centric workflow |
| [mail](mail/) | mail layer provides basic mail client for SpaceVim. |
| [shell](shell/) | This layer provides shell support in SpaceVim |
| [ssh](ssh/) | This layer provides ssh support in SpaceVim |
| [sudo](sudo/) | sudo layer provides the ability to read and write files with elevated privileges in SpaceVim |

View File

@ -0,0 +1,28 @@
---
title: "SpaceVim lang#jsonnet layer"
description: "jsonnet language support, include syntax highlighting."
---
# [Available Layers](../../) >> lang#jsonnet
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Install](#install)
<!-- vim-markdown-toc -->
## Description
This layer is for editing jsonnet file, including syntax highlighting.
## Install
To use this configuration layer, update your custom configuration file with:
```toml
[[layers]]
name = "lang#jsonnet"
```