Put vimgrep matches in files from :scriptnames
into the quickfix list
Using :scriptnames
allows to consider
- only files which have actually been sourced
- and then you can grep for the full and abbreviated option name (regex pattern)
Steps
vim demo.tex
or
do whatever you need to do to get to the point where you want to find out how you ended up with the current setting.
Run :Scriptnames
from vim-scriptease. This populates the quickfix list with results from :scriptnames
.
Fill arglist from quickfixlist (Is there a better solution?)
:argdelete * " if necessary
:for f in map(getqflist(), {i, v -> bufname(v.bufnr)}) | exe('argadd '.f) | endfor
Search with vimgrep all entries in arglist
:vim /\<errorformat\>\|\<efm\>/ ##
Now one can cycle through likely candidates.
Step 3 and 4 can be combined and avoids to use the arglist:
:exe('vimgrep /\<errorformat\>\|\<efm\>/ '.join(map(getqflist(), {i, v -> bufname(v.bufnr)})))
However, if you want to try different regex pattern, you might find it better to keep them separated.
If you wish to see a list of files to get a first overview which script is involved, you could run
:for f in uniq(sort(map(getqflist(), {i, v -> bufname(v.bufnr)})))| echo f | endfor
In my case I get for /\<errorformat\>\|\<efm\>/
:
/Users/hotschke/.vim/pack/lervag/start/vimtex/autoload/vimtex/qf/latexlog.vim
/Users/hotschke/.vim/pack/tpope/start/dispatch/autoload/dispatch.vim
/Users/hotschke/.vim/pack/tpope/start/fugitive/autoload/fugitive.vim
/Users/hotschke/.vim/pack/tpope/start/projectionist/autoload/projectionist.vim
However, this is not perfect and it would be better to have something similar for $ vim -V15vim.log
. But extracting the match and the corresponding file from the log file is more complicated (mostly due to autoloaded functions).