diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-01 07:45:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-28 23:45:47 +0000 |
commit | 45d7aa3301d436aef3cf5d88db8d0da145f9b70c (patch) | |
tree | fe00e2cd4708f623339f6bc0ec1481feb6aa3f6c | |
parent | 7b4295390f951d902ebc34012729e92904d4c1ee (diff) | |
download | rneovim-45d7aa3301d436aef3cf5d88db8d0da145f9b70c.tar.gz rneovim-45d7aa3301d436aef3cf5d88db8d0da145f9b70c.tar.bz2 rneovim-45d7aa3301d436aef3cf5d88db8d0da145f9b70c.zip |
vim-patch:9.1.1158: :verbose set has wrong file name with :compiler! (#32682)
Problem: :verbose set has wrong file name with :compiler!
Solution: Add -keepscript (zeertzjq)
closes: vim/vim#16752
https://github.com/vim/vim/commit/5e8b2268e180cbf5079ea6dbe9c8fd29c3e3133c
-rw-r--r-- | src/nvim/ex_cmds2.c | 2 | ||||
-rw-r--r-- | test/old/testdir/test_compiler.vim | 27 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 61a6dab897..5bd79719e7 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -734,7 +734,7 @@ void ex_compiler(exarg_T *eap) if (eap->forceit) { // ":compiler! {name}" sets global options - do_cmdline_cmd("command -nargs=* CompilerSet set <args>"); + do_cmdline_cmd("command -nargs=* -keepscript CompilerSet set <args>"); } else { // ":compiler! {name}" sets local options. // To remain backwards compatible "current_compiler" is always diff --git a/test/old/testdir/test_compiler.vim b/test/old/testdir/test_compiler.vim index 1310cbadfc..5e13eb37ba 100644 --- a/test/old/testdir/test_compiler.vim +++ b/test/old/testdir/test_compiler.vim @@ -20,12 +20,14 @@ func Test_compiler() e Xfoo.pl " Play nice with other tests. defer setqflist([]) + compiler perl call assert_equal('perl', b:current_compiler) call assert_fails('let g:current_compiler', 'E121:') - let verbose_efm = execute('verbose set efm') call assert_match('Last set from .*[/\\]compiler[/\\]perl.vim ', verbose_efm) + " Not using the global value + call assert_notequal('', &l:efm) call setline(1, ['#!/usr/bin/perl -w', 'use strict;', 'my $foo=1']) w! @@ -39,6 +41,29 @@ func Test_compiler() call assert_match('\n \d\+ Xfoo.pl:3: Global symbol "$foo" ' \ . 'requires explicit package name', a) + compiler make + call assert_fails('let b:current_compiler', 'E121:') + call assert_fails('let g:current_compiler', 'E121:') + let verbose_efm = execute('verbose set efm') + call assert_match('Last set from .*[/\\]compiler[/\\]make.vim ', verbose_efm) + + compiler! perl + call assert_equal('perl', b:current_compiler) + call assert_equal('perl', g:current_compiler) + let verbose_efm = execute('verbose set efm') + call assert_match('Last set from .*[/\\]compiler[/\\]perl.vim ', verbose_efm) + call assert_equal(verbose_efm, execute('verbose setglobal efm')) + " Using the global value + call assert_equal('', &l:efm) + + compiler! make + call assert_fails('let b:current_compiler', 'E121:') + call assert_fails('let g:current_compiler', 'E121:') + let verbose_efm = execute('verbose set efm') + call assert_match('Last set from .*[/\\]compiler[/\\]make.vim ', verbose_efm) + call assert_equal(verbose_efm, execute('verbose setglobal efm')) + " Using the global value + call assert_equal('', &l:efm) let &shellslash = save_shellslash call delete('Xfoo.pl') |