Vim: Implement nohl to disable all search highlights

Created on 10 Nov 2016  路  13Comments  路  Source: VSCodeVim/Vim

Please thumbs-up 馃憤 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


What did you do?

Search for a word contained in the open file with /. Then typing :nohl.

What did you expect to happen?

The search highlight for the current search should be disabled.

What happened instead?

:nohl had no effect.

Technical details:

  • VSCode Version: 1.7.1
  • VsCodeVim Version: 0.4.1
  • OS: Windows 8.1
sizM

All 13 comments

Interesting, currently for configurations we don't have alias support but it should be easy.

:nohlsearch doesn't work either, so I don't know how his is related to aliasing. This is not about changing the settings in settings.json, these should not be touched!

From the vim help:

                            *:noh* *:nohlsearch*
:noh[lsearch]       Stop the highlighting for the 'hlsearch' option.  It
            is automatically turned back on when using a search
            command, or setting the 'hlsearch' option.
            This command doesn't work in an autocommand, because
            the highlighting state is saved and restored when
            executing autocommands |autocmd-searchpat|.
            Same thing for when invoking a user function.

@FSMaxB are you using Insider as well? It might share the same root cause as https://github.com/VSCodeVim/Vim/issues/423#issuecomment-259600175 .

No, I'm not using insider. How is this related to #423?

@FSMaxB the reason that #423 doesn't work is that setting relative line number is actually changing Code's one config. Thanks for the help!

Now this one is way more severe than I thought.

I wouldn't consider the priority critical, but it's definitely a nice to have feature.

Workaround: Make a new empty search /<enter>. That has almost the same effect (except that the search term gets lost).

In the meantime you can put "vim.hlsearch": false in your settings.json, which has the same effect.

No, it does not have the same effect. Setting vim.hlsearch to false disables the highlighting completely. That is not what :nohlsearch does!

Stop the highlighting for the 'hlsearch' option. It is automatically turned back on when using a search command

from the vim help

set nohlsearch now works. But alias is still not supported.

Sorry, close it too quick. It's about :nohl but not disable it globally.

Added in master and will be released in 0.4.7!

Works great, thanks!

Was this page helpful?
0 / 5 - 0 ratings