开发者

mapping the 'n' key in vim while not searching

开发者 https://www.devze.com 2023-02-27 10:11 出处:网络
Is it possible to map over the \'n\' and \'N\' keys with开发者_高级运维out overriding the time they\'re used for skimming search results?Basically you could be searching for something any given time,

Is it possible to map over the 'n' and 'N' keys with开发者_高级运维out overriding the time they're used for skimming search results?


Basically you could be searching for something any given time, so remapping n in normal mode without modifications would override the skimming.

After a little considering, if you always quit your searchings with <C-l> (clearing the highlights, I'm not sure if that is the default), you could indeed do something like this with a few extra helper functions:

/,?,*:
 --> set s:searching = true
     and do the builtin things

<C-l>:
 --> set s:searching = false
     and do the builtin things

n,N:
 --> if s:searching then use the builtin n
     else activate your own functionality 


Yes you can map a key in a certain mode. You could read over the documentation for map for all of the available options to fine tune your mappings.

Specifically, the map-overview for a list of the mappings and what mode they are used in.

0

精彩评论

暂无评论...
验证码 换一张
取 消