From be9eaac7e8ee9961ffe1e5d5d25dfc3b7a83ba57 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 4 Aug 2024 18:59:34 +0200 Subject: [PATCH 1/2] vim-patch:c5bdd66: runtime(zip): escape '[' on Unix as well Problem: After 6f1cbfc9ab483a09877e153ad130164875c40b1d fnameescape() is no longer called on the name of the file to be extracted. However, while spaces indeed don't need to be escaped, unzip treats '[' as a wildcard character, so it need to be escaped. Solution: Escape '[' on both MS-Windows and Unix. From the docs it seems '*' and '?' also need escaping, but they seem to actually work without escaping. fixes: neovim/neovim#29977 closes: vim/vim#15427 https://github.com/vim/vim/commit/c5bdd66558b14f04424a22d9714a9b7d0c277dac Co-authored-by: zeertzjq --- runtime/autoload/zip.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index f77d729f03..e8973e3c80 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -9,6 +9,7 @@ " 2024 Jul 23 by Vim Project: fix 'x' command " 2024 Jul 24 by Vim Project: use delete() function " 2024 Jul 20 by Vim Project: fix opening remote zipfile +" 2024 Aug 04 by Vim Project: escape '[' in name of file to be extracted " 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, @@ -218,8 +219,8 @@ fun! zip#Read(fname,mode) else let zipfile = substitute(a:fname,'^.\{-}zipfile://\(.\{-}\)::[^\\].*$','\1','') let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','') - let fname = substitute(fname, '[', '[[]', 'g') endif + let fname = substitute(fname, '[', '[[]', 'g') " sanity check if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','','')) redraw! @@ -230,7 +231,7 @@ fun! zip#Read(fname,mode) endif " the following code does much the same thing as - " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) + " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1) " but allows zipfile://... entries in quickfix lists let temp = tempname() let fn = expand('%:p') From 28e2e8aa04308fbba1cdd9ec65305af95d9d1a0f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 4 Aug 2024 18:59:47 +0200 Subject: [PATCH 2/2] vim-patch:c0f7505: runtime(lua): add/subtract a 'shiftwidth' after '('/')' in indentexpr Problem: - Current lua indentexpr does not indent for '(' ')'. - Missing indent test for lua. Solution: - Match '(', ')' in `function GetLuaIndentIntern`. - Add an indent test for lua. closes: vim/vim#15364 https://github.com/vim/vim/commit/c0f7505edeb36bf3e19386f276cafad7cba717a2 Co-authored-by: Yinzuo Jiang --- runtime/indent/lua.vim | 9 +++++---- runtime/indent/testdir/lua.in | 19 +++++++++++++++++++ runtime/indent/testdir/lua.ok | 19 +++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 runtime/indent/testdir/lua.in create mode 100644 runtime/indent/testdir/lua.ok diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index 35b08d4037..ce6cfe18cd 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -4,6 +4,7 @@ " First Author: Max Ischenko " Last Change: 2017 Jun 13 " 2022 Sep 07: b:undo_indent added by Doug Kearns +" 2024 Jul 27: by Vim project: match '(', ')' in function GetLuaIndentIntern() " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -46,12 +47,12 @@ function! GetLuaIndentIntern() endif " Add a 'shiftwidth' after lines that start a block: - " 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{' + " 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{', '(' let ind = indent(prevlnum) let prevline = getline(prevlnum) let midx = match(prevline, '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\|then\>\)') if midx == -1 - let midx = match(prevline, '{\s*\%(--\%([^[].*\)\?\)\?$') + let midx = match(prevline, '\%({\|(\)\s*\%(--\%([^[].*\)\?\)\?$') if midx == -1 let midx = match(prevline, '\\s*\%(\k\|[.:]\)\{-}\s*(') endif @@ -65,9 +66,9 @@ function! GetLuaIndentIntern() endif endif - " Subtract a 'shiftwidth' on end, else, elseif, until and '}' + " Subtract a 'shiftwidth' on end, else, elseif, until, '}' and ')' " This is the part that requires 'indentkeys'. - let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)') + let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\|)\)') if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment" let ind = ind - shiftwidth() endif diff --git a/runtime/indent/testdir/lua.in b/runtime/indent/testdir/lua.in new file mode 100644 index 0000000000..c8f5d2bb8d --- /dev/null +++ b/runtime/indent/testdir/lua.in @@ -0,0 +1,19 @@ +-- vim: set ft=lua sw=2 noet: + +-- START_INDENT +function foo(a, b, c, d) + return { a, b, c, d } +end + +local a = foo( +1, +2, +"longxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", +4 +) + +local b = { +1, + 2, +} +-- END_INDENT diff --git a/runtime/indent/testdir/lua.ok b/runtime/indent/testdir/lua.ok new file mode 100644 index 0000000000..95f9873beb --- /dev/null +++ b/runtime/indent/testdir/lua.ok @@ -0,0 +1,19 @@ +-- vim: set ft=lua sw=2 noet: + +-- START_INDENT +function foo(a, b, c, d) + return { a, b, c, d } +end + +local a = foo( + 1, + 2, + "longxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + 4 +) + +local b = { + 1, + 2, +} +-- END_INDENT