runtime(jq): include syntax, ftplugin and compiler plugin Commit: https://github.com/vim/vim/commit/79952b9c6774d30f248a0ecf9ea84318be947fc4 Author: Vito <vito.b...@gmail.com> Date: Fri Apr 26 22:36:20 2024 +0200
runtime(jq): include syntax, ftplugin and compiler plugin closes: https://github.com/vim/vim/issues/14619 Signed-off-by: Vito <vito.b...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d5ac02ef4..ac41ed567 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -70,6 +70,7 @@ runtime/compiler/jest.vim @dkearns runtime/compiler/jjs.vim @dkearns runtime/compiler/jshint.vim @dkearns runtime/compiler/jsonlint.vim @dkearns +runtime/compiler/jq.vim @vito-c runtime/compiler/lazbuild.vim @dkearns runtime/compiler/perl.vim @petdance @heptite runtime/compiler/perlcritic.vim @petdance @dkearns @@ -164,6 +165,7 @@ runtime/ftplugin/json.vim @dbarnett runtime/ftplugin/json5.vim @dkearns runtime/ftplugin/jsonc.vim @izhakjakov runtime/ftplugin/julia.vim @carlobaldassi +runtime/ftplugin/jq.vim @vito-c runtime/ftplugin/kconfig.vim @chrisbra runtime/ftplugin/kotlin.vim @udalov runtime/ftplugin/less.vim @genoma @@ -404,8 +406,10 @@ runtime/syntax/j.vim @glts runtime/syntax/jargon.vim @h3xx runtime/syntax/java.vim @zzzyxwvut runtime/syntax/javascript.vim @fleiner +runtime/syntax/json.vim @vito-c runtime/syntax/jsonc.vim @izhakjakov runtime/syntax/julia.vim @carlobaldassi +runtime/syntax/jq.vim @vito-c runtime/syntax/kconfig.vim @chrisbra runtime/syntax/kotlin.vim @udalov runtime/syntax/krl.vim @KnoP-01 diff --git a/runtime/compiler/jq.vim b/runtime/compiler/jq.vim new file mode 100644 index 000000000..a656223e5 --- /dev/null +++ b/runtime/compiler/jq.vim @@ -0,0 +1,25 @@ +" Vim compiler file +" Compiler: jq +" Maintainer: Vito <vito.b...@gmail.com> +" Last Change: 2024 Apr 17 +" Upstream: https://github.com/vito-c/jq.vim + +if exists('b:current_compiler') + finish +endif +let b:current_compiler = 'jq' + +let s:save_cpoptions = &cpoptions +set cpoptions&vim + +if has('unix') + CompilerSet makeprg=jq\ -f\ %:S\ /dev/null +else + CompilerSet makeprg=jq\ -f\ %:S\ nul +endif +CompilerSet errorformat=%E%m\ at\ \<%o\>\,\ line\ %l:, + \%Z, + \%-G%.%# + +let &cpoptions = s:save_cpoptions +unlet s:save_cpoptions diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 873315c82..bfc464534 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -2086,6 +2086,15 @@ To disable syntax highlighting of errors: > let g:vim_json_warnings = 0 +JQ *jq.vim* *jq_quote_highlight* *ft-jq-syntax* + +To disable numbers having their own color add the following to your vimrc: > + hi link jqNumber Normal + +If you want quotes to have different highlighting than strings > + let g:jq_quote_highlight = 1 + + LACE *lace.vim* *ft-lace-syntax* Lace (Language for Assembly of Classes in Eiffel) is case insensitive, but the diff --git a/runtime/ftplugin/jq.vim b/runtime/ftplugin/jq.vim new file mode 100644 index 000000000..15cd400d3 --- /dev/null +++ b/runtime/ftplugin/jq.vim @@ -0,0 +1,18 @@ +" Vim compiler file +" Language: jq +" Maintainer: Vito <vito.b...@gmail.com> +" Last Change: 2024 Apr 17 +" Upstream: https://github.com/vito-c/jq.vim + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = 'setl commentstring<' + +setlocal commentstring=#%s +compiler jq + +let &cpoptions = s:save_cpoptions +unlet s:save_cpoptions diff --git a/runtime/syntax/jq.vim b/runtime/syntax/jq.vim new file mode 100644 index 000000000..272dcb4eb --- /dev/null +++ b/runtime/syntax/jq.vim @@ -0,0 +1,130 @@ +" Vim compiler file +" Language: jq +" Maintainer: Vito <vito.b...@gmail.com> +" Last Change: 2024 Apr 17 +" Upstream: https://github.com/vito-c/jq.vim +" +" Quit when a (custom) syntax file was already loaded +if exists('b:current_syntax') + finish +endif + +" syn include @jqHtml syntax/html.vim " Doc comment HTML + +" jqTodo +syntax keyword jqTodo contained TODO FIXME NOTE XXX + +" jqKeywords +syntax keyword jqKeywords and or not empty +syntax keyword jqKeywords try catch +syntax keyword jqKeywords reduce as label break foreach +syntax keyword jqKeywords import include module modulemeta +syntax keyword jqKeywords env nth has in while error stderr debug + +" jqConditional +syntax keyword jqConditional if then elif else end + +" jqConditions +syntax keyword jqCondtions true false null + +" jqSpecials +syntax keyword jqType type +syntax match jqType /[\|;]/ " not really a type I did this for coloring reasons though :help group-name +syntax region jqParentheses start=+(+ end=+)+ fold transparent + +" jq Functions +syntax keyword jqFunction add all any arrays ascii_downcase floor +syntax keyword jqFunction ascii_upcase booleans bsearch builtins capture combinations +syntax keyword jqFunction -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1s0SRK-00GlUl-Q4%40256bit.org.