Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我重新映射一个键以捕获该键被按下并调用一个函数,在该函数中决定调用一个操作或调用该键,因为此重新映射不存在。但问题是,当我重新映射一个键时,我丢失了映射到该键的操作。
Hot 我可以在 vimscript 中实现这个吗?
您可以:h :normal在函数中使用重新创建重新映射的键的原始功能。例如...
:h :normal
nnoremap l :call MyFun()<cr> fun! MyFun() call inputsave() let choice = confirm("Call fun?", "&yes\n&no", 1) if choice == 1 call OtherFun() else norm! l endif endfun fun! OtherFun() echo "It worked!" endfun