When you search for a word in a file with something like /console.log, all of the instances of console.log are highlighted.When you're no longer interested in these, the highlighting can be distracting. My current strategy for removing the highlighting is to do something like /asntehua. Is there a proper way to remove this word highlighting?
How can I clear word highlighting in the current document (e.g. such as after searching for a word)?
search;highlight
As an alternative to :noh, I like to do :let @/= mapped to a keyboard shortcut.The difference is that :noh leaves the search term in the search register, so n and N in normal mode resume the search by jumping to the next/previous match and re-highlighting.Using :let @/=, on the other hand, causes the message E25: No previous regular expression and leaves your cursor where it was, which is especially convenient if you don't yet know about ctrl-o yet and accidentally hit n.This can also be used the other way. To cause vim to highlight some text without jumping to it, you can :let @/=some textIn these expressions, @ lets you refer to a register, and @/ is the register holding the last search pattern.