VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.88k stars 1.31k forks source link

Set different timeouts for remappings in insert mode and in normal mode #4652

Open reem opened 4 years ago

reem commented 4 years ago

Is your feature request related to a problem? Please describe. Multi-key normal mode remappings have to be entered quickly because they share a timeout with insert mode remappings where it's desirable to have a shorter timeout.

Describe the solution you'd like Allow setting a 2nd timeout that only applies either:

Describe alternatives you've considered Alternatively allow setting a different timeout for every mode, but that may be overkill.

Additional context I have implemented this feature already in a non-backwards compatible way, replacing configuration.timeout with configuration.insertModeTimeout and configuration.otherModesTimeout. Would be happy to get the change upstreamed in a backwards compatible way, let me know what your thoughts are.

EDIT: implementation https://github.com/reem/Vim/tree/split-timeouts

J-Fields commented 4 years ago

Is this a feature in vanilla vim?

EDIT: implementation https://github.com/reem/Vim/tree/split-timeouts

Feel free to submit a PR!

MarcosH911 commented 1 month ago

Any updates on this?

In my init.lua I usually do something like this, but I'm afraid this is not possible in VSCode Vim

vim.api.nvim_create_autocmd('InsertLeave', {
  desc = 'Remove timeout when leaving insert mode',
  callback = function()
    vim.opt.timeout = false
  end,
})

vim.api.nvim_create_autocmd('InsertEnter', {
  desc = 'Add short timeout when entering insert mode',
  callback = function()
    vim.opt.timeoutlen = 100
    vim.opt.timeout = true
  end,
})