简体   繁体   English

Emacs样式突出显示在Vim中

[英]Emacs style highlighting for inc-search in vim

I realize that this question has been posed before on this forum, but I didn't find an answer so here goes.. 我意识到这个问题以前曾在这个论坛上提出过,但是我没有找到答案,所以去了。

In Vim, is there a way to enable on-the-fly highlighting for all matches when searching? 在Vim中,有没有一种方法可以在搜索时对所有匹配项进行即时突出显示?

If I enable incsearch and type "/something" it will highlight the first match only. 如果启用incsearch并键入“ / something”,它将仅突出显示第一个匹配项。 If I enable hlsearch and type "/something", nothing happens until I press enter (it only highlights the previous search). 如果启用hlsearch并键入“ / something”,则在按Enter之前什么都不会发生(它仅突出显示先前的搜索)。

In emacs the first match will be highlighted, and (after a slight delay) all other matches on the screen are highlighted in a different color, giving almost instant feedback when scanning for matches in a piece of code. 在emacs中,第一个匹配项将突出显示,并且(稍有延迟后)屏幕上的所有其他匹配项将以不同的颜色突出显示,从而在扫描一段代码中的匹配项时几乎立即获得反馈。

use the n-search feature of easy-motion , it does exactly what you need(look in the gif demo) BONUS: it also dims down the background for you that really makes searching easy 使用easy-motion的n-search功能,它可以完全满足您的需要(在gif演示中查看)奖金:它还为您调暗了背景,真正使搜索变得容易

https://github.com/Lokaltog/vim-easymotion#n-character-search-motion https://github.com/Lokaltog/vim-easymotion#n-character-search-motion

You can do this with the incsearch.vim plugin: 您可以使用incsearch.vim插件执行此操作:

类似于emacs的incsearch:在增量搜索时移动光标

You need to first install the plugin and bind <Over>(incsearch-...) . 您需要首先安装插件并绑定<Over>(incsearch-...)

You are looking for :set incsearch together with hlsearch. 您正在寻找:set incsearch和hlsearch。 However all hits will have the same color. 但是,所有匹配都将具有相同的颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM