Another alternative is to load the output of :scriptnames
in a buffer like so:
:call setline('.', split(execute('scriptnames'), '\n'))
This will give you this in the current buffer:
1: ~/.vim/vimrc
2: /usr/share/vim/vim82/syntax/syntax.vim
3: /usr/share/vim/vim82/syntax/synload.vim
4: /usr/share/vim/vim82/syntax/syncolor.vim
5: /usr/share/vim/vim82/filetype.vim
[..]
And you can then use gf
to go to the files.
I find this pattern in general useful enough that I have a little command for it:
comm! -complete=command -nargs=+ Load call call(
\ (len(filter(getline(1, '$'), {_, v -> len(v) > 0})) == 0 ? 'setline' : 'append'),
\ ['.', split(execute(join([<f-args>], ' ')), '\n')])
You can then just type :Load scriptnames
.
You can modify it to automatically create a new (scratch) buffer or split or whatnot (although you can use :new | Load scriptnames
).