1
0
forked from aniani/vim

patch 9.1.1396: 'errorformat' is a global option

Problem:  The 'grepformat' option is global option, but it would be
          useful to have it buffer-local, similar to 'errorformat' and
          other quickfix related options (Dani Dickstein)
Solution: Add the necessary code to support global-local 'grepformat',
          allowing different buffers to parse different grep output
          formats (glepnir)

fixes: #17316
closes: #17315

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
glepnir
2025-05-16 19:49:23 +02:00
committed by Christian Brabandt
parent 670d0c1468
commit 7b9eb6389d
11 changed files with 46 additions and 11 deletions

View File

@@ -2379,6 +2379,25 @@ func Test_grep()
call s:test_xgrep('l')
endfunc
func Test_local_grepformat()
let save_grepformat = &grepformat
set grepformat=%f:%l:%m
" The following line are used for the local grep test. Don't remove.
" UNIQUEPREFIX:2:3: Local grepformat test
new
setlocal grepformat=UNIQUEPREFIX:%c:%n:%m
call assert_equal('UNIQUEPREFIX:%c:%n:%m', &l:grepformat)
call assert_equal('%f:%l:%m', &g:grepformat)
set grepprg=internal
silent grep "^[[:space:]]*\" UNIQUEPREFIX:" test_quickfix.vim
call assert_equal(1, len(getqflist()))
set grepprg&vim
bwipe!
let &grepformat = save_grepformat
endfunc
func Test_two_windows()
" Use one 'errorformat' for two windows. Add an expression to each of them,
" make sure they each keep their own state.