The vim 'scriptnames' command output all scripts loaded. The problem is that I can't find any practical way to filter/search/find on it. I want to look for some script without having to do this by "eye brute force".
You can search/edit here using regular vim commands. You start in Normal mode. Press Enter to execute a command. This approach lets you search across whole command not just beginning of line. Enter the first letters of your previous command and push <Up> arrow (or Ctrl+p).
To see the file names of all scripts loaded (sourced) by Vim, including those loaded implicitly at startup, enter: The list does not include "would-be scripts" (scripts that Vim tried to open but which failed without warning, perhaps because the script could not be found).
To search forward, use the command: Replace pattern with the item (s) you want to find. For example, to search for all instances of the pattern "root", you would: 1. Press Esc to make sure Vim/Vi is in normal mode. 2. Type the command:
Searching for all characters as normal text Place the following in your vimrc : command! -nargs=1 SS let @/ = '\V'.escape (<q-args>, '\') to define a new command SS which allows easy searching for text which includes characters that normally have a special meaning in a search pattern.
There is no such thing as a script
command, there are only scriptencoding
and scriptnames
(which can be abbreviated as scr
, according to :h :scr
). I presume you're looking for scriptnames
.
With Vim 8 you can filter the results of most commands with :filter
:
:filter /pattern/ scriptnames
(cf. :h :filter
).
With older versions of Vim you can redirect all messages to a file before running :scriptnames
, then cancel the redirection:
:redir >file
:scriptnames
:redir END
(cf. :h :redir
). Alternatively, you can redirect messages to a register, then paste the contents of the register to a buffer:
:redir @a
:scriptnames
:redir END
:new
"aP
Finally, Tim Pope's plugin scriptease adds a command :Scriptnames
that runs :scriptnames
and loads the results into a quickfix list.
Instead of :redir
, we have execute()
with recent versions of vim.
Thus, you can play with :echo filter(split(execute('scritnames'), "\n"), 'v:val =~ "somepattern")
or :new
+put=execute(':scriptnames')
+search in the buffer as you would have explored a log life.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With