vim 中特定于键的 timeoutlen [英] Key-specific timeoutlen in vim

查看:103
本文介绍了vim 中特定于键的 timeoutlen的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以根据键入的键设置不同的超时时间?例如,我的 <Esc> 重新映射到 jkjj

Is it possible to set different timeoutlen depending on typed key? For example, I have short timeout to go with my <Esc> remapping to jk or jj

set timeoutlen=200

但是如果我以 <leader> 开头,我希望这个 timeoutlen 更长,因为我有一些需要按下按键序列的映射,这不是那么容易输入作为 jk.

but if I start with a <leader>, I'd like to have this timeoutlen longer, because I have some mappings that require pressing sequence of keys, which are not that easy to type as jk.

推荐答案

没有任何内置的东西.关于您的映射,您可能指的是 :inoremap jj ,为了快速应用它,您只需要确保没有其他以 开头的插入模式映射 jj.为避免第一个 j 出现延迟,您可以使用 :autocmds 来切换 'timeoutlen' 值:

There's nothing built-in. With regards to your mapping, you probably mean :inoremap jj <Esc>, and for that to apply quickly, you just need to ensure that there are no other insert mode mappings that start with jj. To avoid that the first j appears only with a delay, you could use :autocmds to toggle the 'timeoutlen' value:

:autocmd InsertEnter * set timeoutlen=200
:autocmd InsertLeave * set timeoutlen=1000

这篇关于vim 中特定于键的 timeoutlen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆