Christian Ebert wrote:
* A.J.Mechelynck on Friday, August 04, 2006 at 19:51:53 +0200:
You may want to determine which script or plugin is responsible: search for the word "sign" (i.e. the pattern /\<sign\>/ ) in the scripts listed in the output of the ":scriptnames" command.

How exactly do you search the output of ":scriptnames"?

c

You may write it to a file or a register (see :help :redir) but I suggest the following:

- look what Vim answers when you say ":scriptnames"
- if some script seems particularly suspect, load it, e.g.

        :sview $VIM/vimrc

then use seach commands, such as

        /\<sign\>

and, if you don't get an error, find the next occurrence with

        n

or the previous one with

        N



If none of those scripts looks more suspect than any other, here *(untested)* is what you can do to search them all in one fell swoop. Each line beginning with a double quote is a comment decribing the next line.

        " find previous
        :map <S-F2> :cN<CR>
        " find next
        :map <F2> :cn<CR>

( <CR> in the above is less-than, C-for-Charlie, R-for-Romeo, greater-than. After the > you hit Enter to terminate the Ex-command. You may map to something else than F2 if you prefer. I use these mappings to facilitate navigation of the quickfix results, e.g. [see below] the results of the ":vimgrep" command.)

        " redirect to file
        :redir! > ~/scriptnames.log
        " list all scripts sourced so far
        :scriptnames
        " end of redirect
        :redir END
        " open the list in a new window
        :new ~/scriptnames.log
        " remove the starting numbers
        :1:$s/^\s*\d*:\s*//
        " add \ before every space or backslash
        :1,$s/[ \\]/\\\0/g
        " join all lines, space-separated
        :1,$join
        " yank the result to the unnamed register
        :yank
        " don't write the modified file
        :enew!
        " prevent more-prompts during :vimgrep
        :set nomore
        " search the files for the word "sign"
        :vimgrep /\<sign\>/g ^R"

where ^R means "hit Ctrl-R". The double quote after that Ctrl-R will insert all the file names yanked by the :yank command. Then the ":vimgrep" command (which may take some time) will assemble a list of wherever the word "sign" appears in those files. Once the command terminates (the cursor becomes blinking again), hit F2 to get the next match or Shift-F2 for the previous match.

        " (optional) allow the more-prompt for later commands
        :set more



Best regards,
Tony.

Reply via email to