Vim:Debugging
lastmod 2020-03-19created 2020-03-194 edits
Example
Assuming an error has occurred, you can view the full log with the following command.
Suppose the following error is printed.
Error detected while processing function <SNR>95_Highlight_Matching_Pair:
line 71:
E475: Invalid argument: 0
Note the number that follows <SNR> above. Then check the contents of the function above.
Check the contents of line 71 shown in the output.
From the full list of loaded scripts shown by the :scriptnames command, open the script matching the number that follows <SNR>. Then find the function above. /Highlight_Matching_Pair
Find the contents of the line number shown in the output and debug it.
Tip
When printing a variable, using echo as in echo 'Variable: ' . value means it won't show up in :messages, so use echom instead.