diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/zip.vim | 37 | ||||
-rw-r--r-- | runtime/compiler/javac.vim | 9 | ||||
-rw-r--r-- | runtime/doc/options.txt | 3 | ||||
-rw-r--r-- | runtime/doc/quickfix.txt | 7 | ||||
-rw-r--r-- | runtime/doc/various.txt | 2 | ||||
-rw-r--r-- | runtime/indent/kdl.vim | 18 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/options.lua | 3 | ||||
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 1 | ||||
-rw-r--r-- | runtime/syntax/html.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/java.vim | 56 | ||||
-rw-r--r-- | runtime/syntax/kdl.vim | 13 |
11 files changed, 100 insertions, 51 deletions
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index c0034f8a7a..d0e706e83a 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -4,17 +4,18 @@ " Version: 33 " Maintainer: This runtime file is looking for a new maintainer. " Former Maintainer: Charles E Campbell +" Last Change: +" 2024 Jun 16 by Vim Project: handle whitespace on Windows properly (#14998) " License: Vim License (see vim's :help license) -" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" zip.vim and zipPlugin.vim are provided *as is* and comes with -" no warranty of any kind, either expressed or implied. By using -" this plugin, you agree that in no event will the copyright -" holder be liable for any damages resulting from the use -" of this software. -"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore() +" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" zip.vim and zipPlugin.vim are provided *as is* and comes with +" no warranty of any kind, either expressed or implied. By using +" this plugin, you agree that in no event will the copyright +" holder be liable for any damages resulting from the use +" of this software. " --------------------------------------------------------------------- " Load Once: {{{1 @@ -214,7 +215,6 @@ endfun " --------------------------------------------------------------------- " zip#Read: {{{2 fun! zip#Read(fname,mode) -" call Dfunc("zip#Read(fname<".a:fname.">,mode=".a:mode.")") let repkeep= &report set report=10 @@ -226,15 +226,12 @@ fun! zip#Read(fname,mode) let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','') let fname = substitute(fname, '[', '[[]', 'g') endif -" call Decho("zipfile<".zipfile.">") -" call Decho("fname <".fname.">") " sanity check if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','','')) redraw! echohl Error | echo "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program" | echohl None " call inputsave()|call input("Press <cr> to continue")|call inputrestore() let &report= repkeep -" call Dret("zip#Write") return endif @@ -242,10 +239,8 @@ fun! zip#Read(fname,mode) " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) " but allows zipfile://... entries in quickfix lists let temp = tempname() -" call Decho("using temp file<".temp.">") let fn = expand('%:p') - exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp -" call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp) + exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1).' > '.temp sil exe 'keepalt file '.temp sil keepj e! sil exe 'keepalt file '.fnameescape(fn) @@ -254,11 +249,9 @@ fun! zip#Read(fname,mode) filetype detect " cleanup - " keepj 0d " used to be needed for the ...r! ... method set nomod let &report= repkeep -" call Dret("zip#Read") endfun " --------------------------------------------------------------------- @@ -422,7 +415,6 @@ endfun " --------------------------------------------------------------------- " s:Escape: {{{2 fun! s:Escape(fname,isfilt) -" call Dfunc("QuoteFileDir(fname<".a:fname."> isfilt=".a:isfilt.")") if exists("*shellescape") if a:isfilt let qnameq= shellescape(a:fname,1) @@ -432,7 +424,10 @@ fun! s:Escape(fname,isfilt) else let qnameq= g:zip_shq.escape(a:fname,g:zip_shq).g:zip_shq endif -" call Dret("QuoteFileDir <".qnameq.">") + if exists("+shellslash") && &shellslash && &shell =~ "cmd.exe" + " renormalize directory separator on Windows + let qnameq=substitute(qnameq, '/', '\\', 'g') + endif return qnameq endfun diff --git a/runtime/compiler/javac.vim b/runtime/compiler/javac.vim index f5fe84124f..9bd4cdf270 100644 --- a/runtime/compiler/javac.vim +++ b/runtime/compiler/javac.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Java Development Kit Compiler " Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2024 Apr 03 +" Last Change: 2024 Jun 14 if exists("current_compiler") finish @@ -11,7 +11,12 @@ let current_compiler = "javac" let s:cpo_save = &cpo set cpo&vim -CompilerSet makeprg=javac +if exists("g:javac_makeprg_params") + execute $'CompilerSet makeprg=javac\ {escape(g:javac_makeprg_params, ' \|"')}' +else + CompilerSet makeprg=javac +endif + CompilerSet errorformat=%E%f:%l:\ error:\ %m, \%W%f:%l:\ warning:\ %m, \%-Z%p^, diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 244465ed6e..1b71050620 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3842,6 +3842,9 @@ A jump table for the options with a short description can be found at |Q_op|. between tabs and spaces and for trailing blanks. Further changed by the 'listchars' option. + When 'listchars' does not contain "tab" field, tabs are shown as "^I" + or "<09>", like how unprintable characters are displayed. + The cursor is displayed at the start of the space a Tab character occupies, not at the end as usual in Normal mode. To get this cursor position while displaying Tabs with spaces, use: >vim diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 897e503fc4..9ac7492b9b 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1288,6 +1288,13 @@ g:compiler_gcc_ignore_unmatched_lines commands run from make are generating false positives. +JAVAC *compiler-javac* + +Commonly used compiler options can be added to 'makeprg' by setting the +g:javac_makeprg_params variable. For example: > + let g:javac_makeprg_params = "-Xlint:all -encoding utf-8" +< + PANDOC *quickfix-pandoc* *compiler-pandoc* The Pandoc compiler plugin expects that an output file type extension is diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 0287271d4c..63fca2c1aa 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -140,7 +140,7 @@ gx Opens the current filepath or URL (decided by :[range]# [count] [flags] synonym for :number. - *:#!* + *:#!* *vim-shebang* :#!{anything} Ignored, so that you can start a Vim script with: > #!vim -S echo "this is a Vim script" diff --git a/runtime/indent/kdl.vim b/runtime/indent/kdl.vim index b1b004d0a2..b0a6bd90d9 100644 --- a/runtime/indent/kdl.vim +++ b/runtime/indent/kdl.vim @@ -2,7 +2,7 @@ " Language: KDL " Author: Aram Drevekenin <aram@poor.dev> " Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com> -" Last Change: 2024-06-11 +" Last Change: 2024-06-16 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -14,13 +14,17 @@ setlocal indentexpr=KdlIndent() let b:undo_indent = "setlocal indentexpr<" function! KdlIndent(...) - let line = getline(v:lnum) + let line = substitute(getline(v:lnum), '//.*$', '', '') let previousNum = prevnonblank(v:lnum - 1) - let previous = getline(previousNum) + let previous = substitute(getline(previousNum), '//.*$', '', '') - if previous =~ "{" && previous !~ "}" && line !~ "}" && line !~ ":$" - return indent(previousNum) + shiftwidth() - else - return indent(previousNum) + let l:indent = indent(previousNum) + if previous =~ "{" && previous !~ "}" + let l:indent += shiftwidth() endif + if line =~ "}" && line !~ "{" + let l:indent -= shiftwidth() + endif + return l:indent endfunction +" vim: sw=2 sts=2 et diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index befb56d3d5..902df8f7d6 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -3830,6 +3830,9 @@ vim.go.lw = vim.go.lispwords --- between tabs and spaces and for trailing blanks. Further changed by --- the 'listchars' option. --- +--- When 'listchars' does not contain "tab" field, tabs are shown as "^I" +--- or "<09>", like how unprintable characters are displayed. +--- --- The cursor is displayed at the start of the space a Tab character --- occupies, not at the end as usual in Normal mode. To get this cursor --- position while displaying Tabs with spaces, use: diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index c56ece6289..fa90c83b81 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -1783,6 +1783,7 @@ local patterns_hashbang = { ['^janet\\>'] = { 'janet', { vim_regex = true } }, ['^dart\\>'] = { 'dart', { vim_regex = true } }, ['^execlineb\\>'] = { 'execline', { vim_regex = true } }, + ['^vim\\>'] = { 'vim', { vim_regex = true } }, } ---@private diff --git a/runtime/syntax/html.vim b/runtime/syntax/html.vim index c975ae8620..d067dde83c 100644 --- a/runtime/syntax/html.vim +++ b/runtime/syntax/html.vim @@ -191,7 +191,7 @@ syn keyword htmlArg contained step title translate typemustmatch syn match htmlArg contained "\<data-\h\%(\w\|[-.]\)*\%(\_s*=\)\@=" " special characters -syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};" +syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,32};" " Comments (the real ones or the old netscape ones) if exists("html_wrong_comments") diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 1f71f9e4ee..6f64bdc4ed 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -3,7 +3,7 @@ " Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com> " Former Maintainer: Claudio Fleiner <claudio@fleiner.com> " Repository: https://github.com/zzzyxwvut/java-vim.git -" Last Change: 2024 Jun 10 +" Last Change: 2024 Jun 15 " Please check :help java.vim for comments on some of the options available. @@ -14,7 +14,6 @@ if !exists("main_syntax") endif " we define it here so that included files can test for it let main_syntax='java' - syn region javaFold start="{" end="}" transparent fold endif let s:cpo_save = &cpo @@ -40,6 +39,18 @@ else endfunction endif +function! JavaSyntaxFoldTextExpr() abort + return getline(v:foldstart) !~ '/\*\+\s*$' + \ ? foldtext() + \ : printf('+-%s%3d lines: ', + \ v:folddashes, + \ (v:foldend - v:foldstart + 1)) . + \ getline(v:foldstart + 1) +endfunction + +" E120 for "fdt=s:JavaSyntaxFoldTextExpr()" before v8.2.3900. +setlocal foldtext=JavaSyntaxFoldTextExpr() + " Admit the ASCII dollar sign to keyword characters (JLS-17, §3.8): try exec 'syntax iskeyword ' . &l:iskeyword . ',$' @@ -99,7 +110,7 @@ syn match javaClassDecl "\<record\>\%(\s*(\)\@!" syn match javaClassDecl "^class\>" syn match javaClassDecl "[^.]\s*\<class\>"ms=s+1 syn match javaAnnotation "@\%(\K\k*\.\)*\K\k*\>" -syn region javaAnnotation transparent matchgroup=javaAnnotationStart start=/@\%(\K\k*\.\)*\K\k*(/ end=/)/ skip=/\/\*.\{-}\*\/\|\/\/.*$/ contains=javaAnnotation,javaParenT,javaBraces,javaString,javaBoolean,javaNumber,javaTypedef,javaComment,javaLineComment +syn region javaAnnotation transparent matchgroup=javaAnnotationStart start=/@\%(\K\k*\.\)*\K\k*(/ end=/)/ skip=/\/\*.\{-}\*\/\|\/\/.*$/ contains=javaAnnotation,javaParenT,javaBlock,javaString,javaBoolean,javaNumber,javaTypedef,javaComment,javaLineComment syn match javaClassDecl "@interface\>" syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite syn match javaUserLabelRef "\k\+" contained @@ -238,7 +249,7 @@ if exists("java_comment_strings") syn cluster javaCommentSpecial2 add=javaComment2String,javaCommentCharacter,javaNumber,javaStrTempl endif -syn region javaComment matchgroup=javaCommentStart start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,javaCommentError,javaSpaceError,@Spell +syn region javaComment matchgroup=javaCommentStart start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,javaCommentError,javaSpaceError,@Spell fold syn match javaCommentStar contained "^\s*\*[^/]"me=e-1 syn match javaCommentStar contained "^\s*\*$" syn match javaLineComment "//.*" contains=@javaCommentSpecial2,javaTodo,javaCommentMarkupTag,javaSpaceError,@Spell @@ -269,7 +280,7 @@ if !exists("java_ignore_javadoc") && main_syntax != 'jsp' call s:ReportOnce(v:exception) endtry - syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag,javaTodo,javaCommentError,javaSpaceError,@Spell + syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag,javaTodo,javaCommentError,javaSpaceError,@Spell fold exec 'syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle end="\.$" end="\.[ \t\r]\@=" end="\%(^\s*\**\s*\)\@' . s:ff.Peek('80', '') . '<=@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag' syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*\s*\r\=\n\=\s*\**\s*\%({@return\>\)\@=" matchgroup=javaCommentTitle end="}\%(\s*\.*\)*" contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag syn region javaDocTags contained start="{@\%(li\%(teral\|nk\%(plain\)\=\)\|inherit[Dd]oc\|doc[rR]oot\|value\)\>" end="}" @@ -348,8 +359,6 @@ if exists("java_highlight_functions") " Match: [@ɐ] [abstract] [<α, β>] Τʬ[<γ>][[][]] μʭʭ(/* ... */); exec 'syn region javaFuncDef start=/' . s:ff.Engine('\%#=2', '') . '^\s\+\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*\%(p\%(ublic\|rotected\|rivate\)\s\+\)\=\%(\%(abstract\|default\)\s\+\|\%(\%(final\|\%(native\|strictfp\)\|s\%(tatic\|ynchronized\)\)\s\+\)*\)\=\%(<.*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\s\+\)\=\%(void\|\%(b\%(oolean\|yte\)\|char\|short\|int\|long\|float\|double\|\%(\<\K\k*\>\.\)*\<' . s:ff.UpperCase('[$_[:upper:]]', '[^a-z0-9]') . '\k*\>\%(<[^(){}]*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\)\=\)\%(\[\]\)*\)\s\+\<' . s:ff.LowerCase('[$_[:lower:]]', '[^A-Z0-9]') . '\k*\>\s*(/ end=/)/ skip=/\/\*.\{-}\*\/\|\/\/.*$/ contains=@javaFuncParams' endif - - syn match javaBraces "[{}]" endif if exists("java_highlight_debug") @@ -404,14 +413,18 @@ if exists("java_highlight_debug") endif if exists("java_mark_braces_in_parens_as_errors") - syn match javaInParen contained "[{}]" - hi def link javaInParen javaError + syn match javaInParen contained "[{}]" + hi def link javaInParen javaError endif +" Try not to fold top-level-type bodies under assumption that there is +" but one such body. +exec 'syn region javaBlock transparent start="\%(^\|^\S[^:]\+\)\@' . s:ff.Peek('120', '') . '<!{" end="}" fold' + " catch errors caused by wrong parenthesis -syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1 -syn region javaParenT1 transparent matchgroup=javaParen1 start="(" end=")" contains=@javaTop,javaParenT2 contained -syn region javaParenT2 transparent matchgroup=javaParen2 start="(" end=")" contains=@javaTop,javaParenT contained +syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaInParen,javaParenT1 +syn region javaParenT1 transparent matchgroup=javaParen1 start="(" end=")" contains=@javaTop,javaInParen,javaParenT2 contained +syn region javaParenT2 transparent matchgroup=javaParen2 start="(" end=")" contains=@javaTop,javaInParen,javaParenT contained syn match javaParenError ")" " catch errors caused by wrong square parenthesis syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1 @@ -445,7 +458,7 @@ endif " The @javaTop cluster comprises non-contained Java syntax groups. " Note that the syntax file "aidl.vim" relies on its availability. -syn cluster javaTop contains=TOP,javaDocComment,javaFold,javaParenError,javaParenT +syn cluster javaTop contains=TOP,javaDocComment,javaBlock,javaParenError,javaParenT if !exists("java_minlines") let java_minlines = 10 @@ -463,7 +476,6 @@ exec "syn sync ccomment javaComment minlines=" . java_minlines hi def link javaLambdaDef Function hi def link javaFuncDef Function hi def link javaVarArg Function -hi def link javaBraces Function hi def link javaBranch Conditional hi def link javaUserLabelRef javaUserLabel hi def link javaLabel Label @@ -533,4 +545,20 @@ let b:spell_options = "contained" let &cpo = s:cpo_save unlet s:module_info_cur_buf s:ff s:cpo_save +" See ":help vim9-mix". +if !has("vim9script") + finish +endif + +def! s:JavaSyntaxFoldTextExpr(): string + return getline(v:foldstart) !~ '/\*\+\s*$' + ? foldtext() + : printf('+-%s%3d lines: ', + v:folddashes, + (v:foldend - v:foldstart + 1)) .. + getline(v:foldstart + 1) +enddef + +setlocal foldtext=s:JavaSyntaxFoldTextExpr() +delfunction! g:JavaSyntaxFoldTextExpr " vim: sw=2 ts=8 noet sta diff --git a/runtime/syntax/kdl.vim b/runtime/syntax/kdl.vim index a36bb9e927..97e8f93b61 100644 --- a/runtime/syntax/kdl.vim +++ b/runtime/syntax/kdl.vim @@ -2,7 +2,7 @@ " Language: KDL " Maintainer: Aram Drevekenin <aram@poor.dev> " Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com> -" Latest Revision: 2024-06-10 +" Latest Revision: 2024-06-16 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -13,7 +13,8 @@ syn match kdlNode '\v(\w|-|\=)' display syn match kdlBool '\v(true|false)' display syn keyword kdlTodo contained TODO FIXME XXX NOTE -syn match kdlComment "//.*$" contains=kdlTodo +syn region kdlComment start="//" end="$" contains=kdlTodo,@Spell +syn region kdlComment start="/\*" end="\*/" contains=kdlTodo,@Spell " Regular int like number with - + or nothing in front syn match kdlNumber '\d\+' @@ -22,17 +23,17 @@ syn match kdlNumber '[-+]\d\+' " Floating point number with decimal no E or e (+,-) syn match kdlNumber '\d\+\.\d*' contained display syn match kdlNumber '[-+]\d\+\.\d*' contained display - + " Floating point like number with E and no decimal point (+,-) syn match kdlNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' contained display syn match kdlNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' contained display - + " Floating point like number with E and decimal point (+,-) syn match kdlNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display syn match kdlNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display syn region kdlString start='"' end='"' skip='\\\\\|\\"' display - + syn region kdlChildren start="{" end="}" contains=kdlString,kdlNumber,kdlNode,kdlBool,kdlComment hi def link kdlTodo Todo @@ -43,3 +44,5 @@ hi def link kdlString String hi def link kdlNumber Number let b:current_syntax = "kdl" + +" vim: sw=2 sts=2 et |