diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 19:06:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 19:06:16 +0000 |
commit | 1585b6dc94be23cda47cdeac939c2c74a8bd4c37 (patch) | |
tree | 745848c44400b14f40b4fb05aaf634578a525020 /runtime | |
parent | Releasing progress-linux version 2:9.1.0374-1~progress7.99u1. (diff) | |
download | vim-1585b6dc94be23cda47cdeac939c2c74a8bd4c37.tar.xz vim-1585b6dc94be23cda47cdeac939c2c74a8bd4c37.zip |
Merging upstream version 2:9.1.0377.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/compiler/jq.vim | 25 | ||||
-rw-r--r-- | runtime/doc/cmdline.txt | 8 | ||||
-rw-r--r-- | runtime/doc/pattern.txt | 2 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 9 | ||||
-rw-r--r-- | runtime/doc/tags | 4 | ||||
-rw-r--r-- | runtime/doc/usr_05.txt | 14 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 2 | ||||
-rw-r--r-- | runtime/doc/version9.txt | 3 | ||||
-rw-r--r-- | runtime/ftplugin/jq.vim | 18 | ||||
-rw-r--r-- | runtime/pack/dist/opt/comment/autoload/comment.vim | 58 | ||||
-rw-r--r-- | runtime/pack/dist/opt/comment/doc/comment.txt | 59 | ||||
-rw-r--r-- | runtime/pack/dist/opt/comment/plugin/comment.vim | 9 | ||||
-rw-r--r-- | runtime/syntax/jq.vim | 130 | ||||
-rw-r--r-- | runtime/syntax/json.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/shared/debversions.vim | 4 |
15 files changed, 339 insertions, 8 deletions
diff --git a/runtime/compiler/jq.vim b/runtime/compiler/jq.vim new file mode 100644 index 0000000..a656223 --- /dev/null +++ b/runtime/compiler/jq.vim @@ -0,0 +1,25 @@ +" Vim compiler file +" Compiler: jq +" Maintainer: Vito <vito.blog@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/cmdline.txt b/runtime/doc/cmdline.txt index 13c4d72..6a7515a 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 9.1. Last change: 2023 Dec 09 +*cmdline.txt* For Vim version 9.1. Last change: 2024 Apr 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -650,6 +650,12 @@ followed by another Vim command: :[range]! a user defined command without the "-bar" argument |:command| + and the following |Vim9-script| keywords: + :abstract + :class + :enum + :interface + Note that this is confusing (inherited from Vi): With ":g" the '|' is included in the command, with ":s" it is not. diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index c23462c..f16e7d2 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1404,7 +1404,7 @@ Finally, these constructs are unique to Perl: rules. Both methods can be used to conceal text. Thus the matching functions like |matchadd()| won't consider - syntax rules and functions like |synconcealend()| and the + syntax rules and functions like |synconcealed()| and the other way around. *:mat* *:match* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 873315c..bfc4645 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/doc/tags b/runtime/doc/tags index dcd8db7..8096f5d 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -6515,6 +6515,7 @@ command-block vim9.txt /*command-block* command-line-functions usr_41.txt /*command-line-functions* command-line-window cmdline.txt /*command-line-window* command-mode intro.txt /*command-mode* +comment-install usr_05.txt /*comment-install* compatible-default starting.txt /*compatible-default* compile-changes-5 version5.txt /*compile-changes-5* compile-changes-6 version6.txt /*compile-changes-6* @@ -7291,6 +7292,7 @@ ft-inform-syntax syntax.txt /*ft-inform-syntax* ft-java-plugin filetype.txt /*ft-java-plugin* ft-java-syntax syntax.txt /*ft-java-syntax* ft-javascript-omni insert.txt /*ft-javascript-omni* +ft-jq-syntax syntax.txt /*ft-jq-syntax* ft-json-plugin filetype.txt /*ft-json-plugin* ft-json-syntax syntax.txt /*ft-json-syntax* ft-ksh-syntax syntax.txt /*ft-ksh-syntax* @@ -8408,6 +8410,8 @@ job_start() channel.txt /*job_start()* job_status() channel.txt /*job_status()* job_stop() channel.txt /*job_stop()* join() builtin.txt /*join()* +jq.vim syntax.txt /*jq.vim* +jq_quote_highlight syntax.txt /*jq_quote_highlight* js_decode() builtin.txt /*js_decode()* js_encode() builtin.txt /*js_encode()* jsbterm-mouse options.txt /*jsbterm-mouse* diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index 05239ee..063af9b 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -1,4 +1,4 @@ -*usr_05.txt* For Vim version 9.1. Last change: 2023 Sep 12 +*usr_05.txt* For Vim version 9.1. Last change: 2024 Apr 26 VIM USER MANUAL - by Bram Moolenaar @@ -436,6 +436,18 @@ when Vim starts, add the following line to your vimrc file: > After restarting your Vim, the plugin is active and you can read about it at: > :h editorconfig.txt + +Adding comment package *comment-install* + +Load the plugin with this command: > + packadd comment +< +This way you can use the plugin with the default key bindings `gc` and similar +for commenting (which is a well-established mapping in the Vim community). + +After restarting your Vim, the plugin is active and you can read about it at: > + :h comment.txt + More information about packages can be found here: |packages|. ============================================================================== diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 8e71948..6137cfd 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1096,7 +1096,7 @@ Syntax and highlighting: *syntax-functions* *highlighting-functions* synIDattr() get a specific attribute of a syntax ID synIDtrans() get translated syntax ID synstack() get list of syntax IDs at a specific position - synconcealed() get info about (synax) concealing + synconcealed() get info about (syntax) concealing diff_hlID() get highlight ID for diff mode at a position matchadd() define a pattern to highlight (a "match") matchaddpos() define a list of positions to highlight diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index c277923..03050ee 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -1,4 +1,4 @@ -*version9.txt* For Vim version 9.1. Last change: 2024 Apr 14 +*version9.txt* For Vim version 9.1. Last change: 2024 Apr 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -41554,6 +41554,7 @@ Enum support for Vim9 script |:enum| Other improvements *new-other-9.2* ------------------ +The comment plugin |comment-install| is included. Changed *changed-9.2* ------- diff --git a/runtime/ftplugin/jq.vim b/runtime/ftplugin/jq.vim new file mode 100644 index 0000000..15cd400 --- /dev/null +++ b/runtime/ftplugin/jq.vim @@ -0,0 +1,18 @@ +" Vim compiler file +" Language: jq +" Maintainer: Vito <vito.blog@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/pack/dist/opt/comment/autoload/comment.vim b/runtime/pack/dist/opt/comment/autoload/comment.vim new file mode 100644 index 0000000..9dda266 --- /dev/null +++ b/runtime/pack/dist/opt/comment/autoload/comment.vim @@ -0,0 +1,58 @@ +vim9script + +# Maintainer: Maxim Kim <habamax@gmail.com> +# Last Update: 2024-04-26 +# +# Toggle comments +# Usage: +# Add following mappings to vimrc: +# import autoload 'dist/comment.vim' +# nnoremap <silent> <expr> gc comment.Toggle() +# xnoremap <silent> <expr> gc comment.Toggle() +# nnoremap <silent> <expr> gcc comment.Toggle() .. '_' +export def Toggle(...args: list<string>): string + if len(args) == 0 + &opfunc = matchstr(expand('<stack>'), '[^. ]*\ze[') + return 'g@' + endif + if empty(&cms) || !&ma | return '' | endif + var cms = substitute(substitute(&cms, '\S\zs%s\s*', ' %s', ''), '%s\ze\S', '%s ', '') + var [lnum1, lnum2] = [line("'["), line("']")] + var cms_l = split(escape(cms, '*.'), '\s*%s\s*') + if len(cms_l) == 0 | return '' | endif + if len(cms_l) == 1 | call add(cms_l, '') | endif + var comment = 0 + var indent_min = indent(lnum1) + var indent_start = matchstr(getline(lnum1), '^\s*') + for lnum in range(lnum1, lnum2) + if getline(lnum) =~ '^\s*$' | continue | endif + if indent_min > indent(lnum) + indent_min = indent(lnum) + indent_start = matchstr(getline(lnum), '^\s*') + endif + if getline(lnum) !~ $'^\s*{cms_l[0]}.*{cms_l[1]}$' + comment = 1 + endif + endfor + var lines = [] + var line = '' + for lnum in range(lnum1, lnum2) + if getline(lnum) =~ '^\s*$' + line = getline(lnum) + elseif comment + if exists("g:comment_first_col") || exists("b:comment_first_col") + # handle % with substitute + line = printf(substitute(cms, '%s\@!', '%%', 'g'), getline(lnum)) + else + # handle % with substitute + line = printf(indent_start .. substitute(cms, '%s\@!', '%%', 'g'), + strpart(getline(lnum), strlen(indent_start))) + endif + else + line = substitute(getline(lnum), $'^\s*\zs{cms_l[0]} \?\| \?{cms_l[1]}$', '', 'g') + endif + add(lines, line) + endfor + noautocmd keepjumps setline(lnum1, lines) + return '' +enddef diff --git a/runtime/pack/dist/opt/comment/doc/comment.txt b/runtime/pack/dist/opt/comment/doc/comment.txt new file mode 100644 index 0000000..e2bf755 --- /dev/null +++ b/runtime/pack/dist/opt/comment/doc/comment.txt @@ -0,0 +1,59 @@ +*comment.txt* For Vim version 9.1. Last change: 2024 Apr 26 + + + VIM REFERENCE MANUAL + +Commenting and un-commenting text. + +============================================================================== + +The comment.vim package, allows to toggle comments for a single line, a range +of lines or a selected text object. It defines the following mappings: + + *gcc* +gcc to comment/uncomment current line + *o_gc* +gc{motion} to toggle comments for the selected motion + *gcip* +gcip to comment/uncomment current paragraph + *gcG* +gcG to comment/uncomment from current line till the end of a buffer + *v_gc* +{Visual}gc to comment/uncomment the highlighted lines. + +The plugin uses the buffer-local 'commentstring' option value to add or remove +comment markers to the selected lines. Whether it will comment or un-comment +depends on the first line of the range of lines to act upon. When it matches +a comment marker, the line will be un-commented, if it doesn't, the line will +be commented out. Blank and empty lines are not touched. + +If the mapping does not seem to work, chances are high, that this particular +filetype is either not detected by Vim or the filetype plugin does not set the +'commentstring' option. + +You can simply configure this using the following autocommand (e.g. for legacy +Vim script): > + + autocmd Filetype vim :setlocal commentstring="\ %s + +This example sets the " as start of a comment for legacy Vim Script. For Vim9 +script, you would instead use the "#" char: > + + autocmd Filetype vim :setlocal commentstring=#\ %s + +============================================================================== +Options: + +*g:comment_first_col* +*b:comment_first_col* + By default comment chars are added in front of the line, i.e. if the line + was indented, commented line would stay indented as well. + + However some filetypes require a comment char on the first column, use this option + to change default behaviour. + + Use g:comment_first_col to change it globally or b:comment_first_col to + target specific filetype(s). + +============================================================================== +vim:tw=78:ts=8:fo=tcq2:ft=help: diff --git a/runtime/pack/dist/opt/comment/plugin/comment.vim b/runtime/pack/dist/opt/comment/plugin/comment.vim new file mode 100644 index 0000000..94ac067 --- /dev/null +++ b/runtime/pack/dist/opt/comment/plugin/comment.vim @@ -0,0 +1,9 @@ +vim9script + +# Maintainer: Maxim Kim <habamax@gmail.com> +# Last Update: 2024-04-26 + +import autoload 'comment.vim' +nnoremap <silent> <expr> gc comment.Toggle() +xnoremap <silent> <expr> gc comment.Toggle() +nnoremap <silent> <expr> gcc comment.Toggle() .. '_' diff --git a/runtime/syntax/jq.vim b/runtime/syntax/jq.vim new file mode 100644 index 0000000..272dcb4 --- /dev/null +++ b/runtime/syntax/jq.vim @@ -0,0 +1,130 @@ +" Vim compiler file +" Language: jq +" Maintainer: Vito <vito.blog@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 \contains del delpaths endswith explode +syntax keyword jqFunction finites first flatten format from_entries +syntax keyword jqFunction fromdate fromdateiso8601 fromjson fromstream get_jq_origin +syntax keyword jqFunction get_prog_origin get_search_list getpath gmtime group_by +syntax keyword jqFunction gsub halt halt_error implode index indices infinite +syntax keyword jqFunction input input_filename input_line_number inputs inside +syntax keyword jqFunction isempty isfinite isinfinite isnan isnormal iterables +syntax keyword jqFunction join keys keys_unsorted last leaf_paths +syntax keyword jqFunction length limit localtime ltrimstr map map_values +syntax keyword jqFunction match max max_by min min_by +syntax keyword jqFunction mktime nan normals now +syntax keyword jqFunction nulls numbers objects path paths range +syntax keyword jqFunction recurse recurse_down repeat reverse rindex +syntax keyword jqFunction rtrimstr scalars scalars_or_empty scan select +syntax keyword jqFunction setpath sort sort_by split splits with_entries +syntax keyword jqFunction startswith strflocaltime strftime strings strptime sub +syntax keyword jqFunction test to_entries todate todateiso8601 tojson __loc__ +syntax keyword jqFunction tonumber tostream tostring transpose truncate_stream +syntax keyword jqFunction unique unique_by until utf8bytelength values walk +" TODO: $__loc__ is going to be a pain + +" jq Math Functions +syntax keyword jqFunction acos acosh asin asinh atan atanh cbrt ceil cos cosh +syntax keyword jqFunction erf erfc exp exp10 exp2 expm1 fabs floor gamma j0 j1 +syntax keyword jqFunction lgamma lgamma_r log log10 log1p log2 logb nearbyint +syntax keyword jqFunction pow10 rint round significand sin sinh sqrt tan tanh +syntax keyword jqFunction tgamma trunc y0 y1 +syntax keyword jqFunction atan2 copysign drem fdim fmax fmin fmod frexp hypot +syntax keyword jqFunction jn ldexp modf nextafter nexttoward pow remainder +syntax keyword jqFunction scalb scalbln yn +syntax keyword jqFunction fma + +" jq SQL-style Operators +syntax keyword jqFunction INDEX JOIN IN + +" Macro +syntax match jqMacro "@\%(text\|json\|html\|uri\|[ct]sv\|sh\|base64d\?\)\>" + +" Comments +syntax match jqComment "#.*" contains=jqTodo + +" Variables +syn match jqVariables /$[_A-Za-z0-9]\+/ + +" Definition +syntax keyword jqKeywords def nextgroup=jqNameDefinition skipwhite +syn match jqNameDefinition /\<[_A-Za-z0-9]\+\>/ contained nextgroup=jqPostNameDefinition +syn match jqNameDefinition /`[^`]\+`/ contained nextgroup=jqPostNameDefinition + +" Strings +syn region jqError start=+'+ end=+'\|$\|[;)]\@=+ +syn region jqString matchgroup=jqQuote + \ start=+"+ skip=+\\[\\"]+ end=+"+ + \ contains=@Spell,jqInterpolation +syn region jqInterpolation matchgroup=jqInterpolationDelimiter + \ start=+\%([^\\]\%(\\\\\)*\\\)\@<!\\(+ end=+)+ + \ contained contains=TOP + +" Operators +syn match jqOperator /:\|\([-+*/%<>=]\|\/\/\)=\?\|[!|]=\|?\/\// +"syn region jqRange matchgroup=jqSquareBracket start=+\[+ skip=+:+ end=+\]+ + +" Errors +syn keyword jqError _assign _flatten _modify _nwise _plus _negate _minus _multiply +syn keyword jqError _divide _mod _strindices _equal _notequal _less _greater _lesseq +syn keyword jqError _greatereq _sort_by_impl _group_by_impl _min_by_impl _max_by_impl _match_impl _input +" TODO: these errors should show up when doing def _flatten: as well + +" Numbers +syn match jqNumber /\<0[dDfFlL]\?\>/ " Just a bare 0 +syn match jqNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala + +if !exists('jq_quote_highlight') + highlight def link jqQuote String +else + highlight def link jqQuote Type +endif + +hi def link jqCondtions Boolean +hi def link jqVariables Identifier +hi def link jqNameDefinition Function +hi def link jqTodo Todo +hi def link jqComment Comment +hi def link jqKeywords Keyword +hi def link jqType Type +hi def link jqOperator Operator +hi def link jqFunction Function +hi def link jqMacro Macro +hi def link jqError Error +hi def link jqString String +hi def link jqInterpolationDelimiter Delimiter +hi def link jqConditional Conditional +hi def link jqNumber Number diff --git a/runtime/syntax/json.vim b/runtime/syntax/json.vim index 3f49b0c..f61a17e 100644 --- a/runtime/syntax/json.vim +++ b/runtime/syntax/json.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: JSON -" Maintainer: vacancy +" Maintainer: Vito <vito.blog@gmail.com> " Previous Maintainer: Eli Parra <eli@elzr.com> " Last Change: 2019 Sep 17 " Version: 0.12 diff --git a/runtime/syntax/shared/debversions.vim b/runtime/syntax/shared/debversions.vim index 4aec246..e18eca9 100644 --- a/runtime/syntax/shared/debversions.vim +++ b/runtime/syntax/shared/debversions.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Debian version information " Maintainer: Debian Vim Maintainers -" Last Change: 2024 Jan 25 +" Last Change: 2024 Apr 27 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/shared/debversions.vim let s:cpo = &cpo @@ -11,7 +11,7 @@ let g:debSharedSupportedVersions = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', \ 'bullseye', 'bookworm', 'trixie', 'forky', \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'mantic', 'noble', + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'mantic', 'noble', 'oracular', \ 'devel' \ ] let g:debSharedUnsupportedVersions = [ |