From fc4188ded870aa3d31a91fb0ebcf2da225acf1a5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:34:20 +0800 Subject: [PATCH 1/8] vim-patch:6f585da: Overlong translation files may cause repo to become "dirty" Problem: Overlong translation files may cause repo to become "dirty" Solution: Add a test into check.vim to warn for lines being longer than 80 virt columns related: vim/vim#14490 https://github.com/vim/vim/commit/6f585da00bda333d079acf77fe8dd8e1019c987d Co-authored-by: Christian Brabandt --- src/nvim/po/check.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim index e67cb8c149..719e99bb03 100644 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -229,6 +229,14 @@ elseif ctu " endif endif +" Check that all lines are no longer than 80 chars +let overlong = search('\%>80v', 'n') +if overlong > 0 + echomsg "Lines should be wrapped at 80 columns" + if error == 0 + let error = overlong + endif +endif if error == 0 " If all was OK restore the view. From 95b6215f0a9deb87fc9a463b9eb942c64924f9cb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:34:59 +0800 Subject: [PATCH 2/8] vim-patch:c858382: Problem: Commit 6f585d breaks CI Problem: Commit 6f585d breaks CI Solution: Don't error out, simply return an error message. https://github.com/vim/vim/commit/c85838248246ff250b3e8818967cbd658104d72e Co-authored-by: Christian Brabandt --- src/nvim/po/check.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim index 719e99bb03..5139d35f67 100644 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -233,9 +233,10 @@ endif let overlong = search('\%>80v', 'n') if overlong > 0 echomsg "Lines should be wrapped at 80 columns" - if error == 0 - let error = overlong - endif + " TODO: make this an error + " if error == 0 + " let error = overlong + " endif endif if error == 0 From 5e6f0e58ed165eececeed5d16fde2c044e879d94 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:35:18 +0800 Subject: [PATCH 3/8] vim-patch:32a5faa: check.vim complains about overlong comment lines Problem: check.vim complains about overlong comment lines Solution: only check the length of non-commented lines https://github.com/vim/vim/commit/32a5faa6d7592795c6ec77e44dc0357b92b8a681 Co-authored-by: Christian Brabandt --- src/nvim/po/check.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim index 5139d35f67..9ee45fb78d 100644 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -229,8 +229,8 @@ elseif ctu " endif endif -" Check that all lines are no longer than 80 chars -let overlong = search('\%>80v', 'n') +" Check that no lines are longer than 80 chars (except comments) +let overlong = search('^[^#]\%>80v', 'n') if overlong > 0 echomsg "Lines should be wrapped at 80 columns" " TODO: make this an error From 282a794febc4cb9f83ba569aab747ce7d2822549 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:36:38 +0800 Subject: [PATCH 4/8] vim-patch:41adebe: check.vim: detect trailing whitespace https://github.com/vim/vim/commit/41adebe5727fd82347ab8d0c26713f5714616b48 Co-authored-by: Christian Brabandt --- src/nvim/po/check.vim | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim index 9ee45fb78d..5ce0bbf1dd 100644 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -4,6 +4,8 @@ " - All %...s items in "msgid" are identical to the ones in "msgstr". " - An error or warning code in "msgid" matches the one in "msgstr". +" Last Update: 2025 Jul 10 + if 1 " Only execute this if the eval feature is available. " using line continuation @@ -210,19 +212,19 @@ let cte = search('^"Content-Transfer-Encoding:\s\+8-bit', 'n') let ctc = search('^"Content-Type:.*;\s\+\80v', 'n') if overlong > 0 - echomsg "Lines should be wrapped at 80 columns" + echomsg "Warn: Lines should be wrapped at 80 columns" + " TODO: make this an error + " if error == 0 + " let error = overlong + " endif +endif + +" Check that there is no trailing whitespace +let overlong = search('\s\+$', 'n') +if overlong > 0 + echomsg $"Warn: Trailing whitespace at line: {overlong}" " TODO: make this an error " if error == 0 " let error = overlong From e27e4052c852fa935338681e2c243175d2865563 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:37:08 +0800 Subject: [PATCH 5/8] vim-patch:2566a9f: check.vim: Improve po message checks https://github.com/vim/vim/commit/2566a9f29096a65a440140798b0d7b1c0373b213 Co-authored-by: Antonio Giovanni Colombo --- src/nvim/po/check.vim | 150 ++++++++++++++++++++++++++++++------------ 1 file changed, 109 insertions(+), 41 deletions(-) diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim index 5ce0bbf1dd..b34ef2bd1e 100644 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -1,16 +1,21 @@ " Vim script for checking .po files. " -" Go through the file and verify that: -" - All %...s items in "msgid" are identical to the ones in "msgstr". -" - An error or warning code in "msgid" matches the one in "msgstr". +" Goes through the xx.po file (more than once) +" and verify various congruences +" See the comments in the code -" Last Update: 2025 Jul 10 +" Last Update: 2025 Jul 22 -if 1 " Only execute this if the eval feature is available. +if 1" Only execute this if the eval feature is available. -" using line continuation +" Using line continuation (set cpo to vim default value) +let s:save_cpo = &cpo set cpo&vim +" This only works when 'wrapscan' is not set. +let s:save_wrapscan = &wrapscan +set nowrapscan + let filename = "check-" . expand("%:t:r") . ".log" exe 'redir! > ' . filename @@ -46,9 +51,15 @@ func! GetMline() return substitute(idline, '[^%]*\(%([1-9][0-9]*\$)\=[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g') endfunc -" This only works when 'wrapscan' is not set. -let s:save_wrapscan = &wrapscan -set nowrapscan +func! CountNl(first, last) + let nl = 0 + for lnum in range(a:first, a:last) + let nl += count(getline(lnum), "\n") + endfor + return nl +endfunc + +" main " Start at the first "msgid" line. let wsv = winsaveview() @@ -60,63 +71,72 @@ keeppatterns /^msgid\> let error = 0 while 1 + " for each "msgid" + + " check msgid "Text;editor;" + " translation must have two ";" as well let lnum = line('.') if getline(lnum) =~ 'msgid "Text;.*;"' - if getline(lnum + 1) !~ '^msgstr "\([^;]\+;\)\+"' + if getline(lnum + 1) !~ '^msgstr "\([^;]\+;\)\+"$' echomsg 'Mismatching ; in line ' . (lnum + 1) - echomsg 'Did you forget the trailing semicolon?' + echomsg 'Wrong semicolon count' if error == 0 - let error = lnum + 1 + let error = lnum + 1 endif endif endif + " check for equal number of % in msgid and msgstr + " it is skipping the no-c-format strings if getline(line('.') - 1) !~ "no-c-format" - " go over the "msgid" and "msgid_plural" lines + " skip the "msgid_plural" lines let prevfromline = 'foobar' let plural = 0 while 1 if getline('.') =~ 'msgid_plural' - let plural += 1 + let plural += 1 endif let fromline = GetMline() if prevfromline != 'foobar' && prevfromline != fromline - \ && (plural != 1 - \ || count(prevfromline, '%') + 1 != count(fromline, '%')) - echomsg 'Mismatching % in line ' . (line('.') - 1) - echomsg 'msgid: ' . prevfromline - echomsg 'msgid: ' . fromline - if error == 0 - let error = line('.') - endif + \ && (plural != 1 + \ || count(prevfromline, '%') + 1 != count(fromline, '%')) + echomsg 'possibly mismatching % in line ' . (line('.') - 1) + echomsg 'msgid: ' . prevfromline + echomsg 'msgid: ' . fromline + if error == 0 + let error = line('.') + endif endif if getline('.') !~ 'msgid_plural' - break + break endif let prevfromline = fromline endwhile + " checks that for each 'msgid' there is a 'msgstr' if getline('.') !~ '^msgstr' echomsg 'Missing "msgstr" in line ' . line('.') if error == 0 - let error = line('.') + let error = line('.') endif endif - " check all the 'msgstr' lines + " check all the 'msgstr' lines have the same number of '%' + " only the number of '%' is checked, + " %d vs. %s or %d vs. %ld go undetected while getline('.') =~ '^msgstr' let toline = GetMline() if fromline != toline - \ && (plural == 0 || count(fromline, '%') != count(toline, '%') + 1) - echomsg 'Mismatching % in line ' . (line('.') - 1) - echomsg 'msgid: ' . fromline - echomsg 'msgstr: ' . toline - if error == 0 - let error = line('.') - endif + \ && (plural == 0 || count(fromline, '%') != count(toline, '%') + 1) + echomsg 'possibly mismatching % in line ' . (line('.') - 1) + echomsg 'msgid: ' . fromline + echomsg 'msgstr: ' . toline + if error == 0 + let error = line('.') + endif endif if line('.') == line('$') - break + break endif endwhile endif @@ -145,14 +165,6 @@ if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') endif endif -func! CountNl(first, last) - let nl = 0 - for lnum in range(a:first, a:last) - let nl += count(getline(lnum), "\n") - endfor - return nl -endfunc - " Check that the \n at the end of the msgid line is also present in the msgstr " line. Skip over the header. 1 @@ -178,6 +190,55 @@ while 1 endif endwhile +" Check that the eventual continuation of 'msgstr' is well formed +" final '""', '\n"', ' "' are OK +" Beware, it can give false positives if the message is split +" in the middle of a word +1 +keeppatterns /^"MIME-Version: +while 1 + let lnum = search('^msgid\>') + if lnum <= 0 + break + endif + " "msgstr" goes from strlnum to end-1 + let strlnum = search('^msgstr\>') + let end = search('^$') + if end <= 0 + let end = line('$') + 1 + endif + " only if there is a continuation line... + if end > strlnum + 1 + let ilnum = strlnum + while ilnum < end - 1 + let iltype = 0 + if getline( ilnum ) =~ "^msgid_plural" + let iltype = 99 + endif + if getline( ilnum ) =~ "^msgstr[" + let iltype = 98 + endif + if getline( ilnum ) =~ "\"\"" + let iltype = 1 + endif + if getline( ilnum ) =~ " \"$" + let iltype = 2 + endif + if getline( ilnum ) =~ "\\\\n\"$" + let iltype = 3 + endif + if iltype == 0 + echomsg 'Possibly incorrect final at line: ' . ilnum + " TODO: make this an error + " if error == 0 + " let error = ilnum + " endif + endif + let ilnum += 1 + endwhile + endif +endwhile + " Check that the file is well formed according to msgfmts understanding if executable("msgfmt") let filename = expand("%") @@ -262,7 +323,14 @@ endif redir END +" restore original wrapscan let &wrapscan = s:save_wrapscan unlet s:save_wrapscan +" restore original cpo +let &cpo = s:save_cpo +unlet s:save_cpo + endif + +" vim:sts=2:sw=2:et From 965f54cf5027a765b6969f75828f7ce23c913f1c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:39:28 +0800 Subject: [PATCH 6/8] vim-patch:96dab9c: check.vim: Further improve po message checks https://github.com/vim/vim/commit/96dab9c9b1a1046a4f30ed0aed5686136d52ed19 Co-authored-by: Antonio Giovanni Colombo --- src/nvim/po/check.vim | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) mode change 100644 => 100755 src/nvim/po/check.vim diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim old mode 100644 new mode 100755 index b34ef2bd1e..d582f98199 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -4,9 +4,9 @@ " and verify various congruences " See the comments in the code -" Last Update: 2025 Jul 22 +" Last Update: 2025 Aug 06 -if 1" Only execute this if the eval feature is available. +if 1 " Only execute this if the eval feature is available. " Using line continuation (set cpo to vim default value) let s:save_cpo = &cpo @@ -74,7 +74,7 @@ while 1 " for each "msgid" " check msgid "Text;editor;" - " translation must have two ";" as well + " translation must have two or more ";" (in case of more categories) let lnum = line('.') if getline(lnum) =~ 'msgid "Text;.*;"' if getline(lnum + 1) !~ '^msgstr "\([^;]\+;\)\+"$' @@ -191,7 +191,7 @@ while 1 endwhile " Check that the eventual continuation of 'msgstr' is well formed -" final '""', '\n"', ' "' are OK +" final '""', '\n"', ' "' '/"' '."' '-"' are OK " Beware, it can give false positives if the message is split " in the middle of a word 1 @@ -213,19 +213,28 @@ while 1 while ilnum < end - 1 let iltype = 0 if getline( ilnum ) =~ "^msgid_plural" - let iltype = 99 + let iltype = 2 endif if getline( ilnum ) =~ "^msgstr[" - let iltype = 98 + let iltype = 2 endif if getline( ilnum ) =~ "\"\"" let iltype = 1 endif if getline( ilnum ) =~ " \"$" - let iltype = 2 + let iltype = 1 + endif + if getline( ilnum ) =~ "-\"$" + let iltype = 1 + endif + if getline( ilnum ) =~ "/\"$" + let iltype = 1 + endif + if getline( ilnum ) =~ "\\.\"$" + let iltype = 1 endif if getline( ilnum ) =~ "\\\\n\"$" - let iltype = 3 + let iltype = 1 endif if iltype == 0 echomsg 'Possibly incorrect final at line: ' . ilnum From 5f86b4b70d980e85951635125f559ec5f0e3ed60 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:39:59 +0800 Subject: [PATCH 7/8] vim-patch:4105ef1: Drop superfluous execute permissions for readable files - runtime/ftplugin/plsql.vim (42e498) - runtime/pack/dist/opt/editorconfig/LICENSE.PSF (e5e043) - src/po/check.vim (96dab9) - src/po/it.po (bb0d3b) closes: vim/vim#18666 https://github.com/vim/vim/commit/4105ef16e363c45806773c5d4deddfa81aea7b81 Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com> --- src/nvim/po/check.vim | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/nvim/po/check.vim diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim old mode 100755 new mode 100644 From cae4fbf973de05b6beb9b8593784f168e128cdb6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Jan 2026 13:40:49 +0800 Subject: [PATCH 8/8] vim-patch:3456303: check.vim: Use silent command modifier Problem: When checking a .po file (make -C src/po check), errors are not displayed. Solution: Adding "silent" to some normal commands in check.vim suppresses unnecessary output (Muraoka Taro) This is because the output of check.vim is redirected to /dev/null. However, if you stop the redirection, check.vim generates a lot of output and becomes very slow. When these commands are run in ex mode, they output the contents of the line the cursor is pointing to. This caused a lot of output. closes: vim/vim#19227 https://github.com/vim/vim/commit/3456303430a3fd2e628a850f90845cc4cbaa7994 Co-authored-by: Muraoka Taro --- src/nvim/po/check.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/nvim/po/check.vim b/src/nvim/po/check.vim index d582f98199..d2713c1a21 100644 --- a/src/nvim/po/check.vim +++ b/src/nvim/po/check.vim @@ -25,7 +25,7 @@ exe 'redir! > ' . filename func! GetMline() let idline = substitute(getline('.'), '"\(.*\)"$', '\1', '') while line('.') < line('$') - + + silent + let line = getline('.') if line[0] != '"' break @@ -63,8 +63,8 @@ endfunc " Start at the first "msgid" line. let wsv = winsaveview() -1 -keeppatterns /^msgid\> +silent 1 +silent keeppatterns /^msgid\> " When an error is detected this is set to the line number. " Note: this is used in the Makefile. @@ -157,7 +157,7 @@ endwhile " - msgstr "E123 ..." missing colon " - msgstr "..." missing error code " -1 +silent 1 if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0 echomsg 'Mismatching error/warning code in line ' . line('.') if error == 0 @@ -167,8 +167,8 @@ endif " Check that the \n at the end of the msgid line is also present in the msgstr " line. Skip over the header. -1 -keeppatterns /^"MIME-Version: +silent 1 +silent keeppatterns /^"MIME-Version: while 1 let lnum = search('^msgid\>') if lnum <= 0 @@ -194,8 +194,8 @@ endwhile " final '""', '\n"', ' "' '/"' '."' '-"' are OK " Beware, it can give false positives if the message is split " in the middle of a word -1 -keeppatterns /^"MIME-Version: +silent 1 +silent keeppatterns /^"MIME-Version: while 1 let lnum = search('^msgid\>') if lnum <= 0 @@ -262,7 +262,7 @@ if executable("msgfmt") endif " Check that the plural form is properly initialized -1 +silent 1 let plural = search('^msgid_plural ', 'n') if (plural && search('^"Plural-Forms: ', 'n') == 0) || (plural && search('^msgstr\[0\] ".\+"', 'n') != plural + 1) if search('^"Plural-Forms: ', 'n') == 0