max397574 / better-escape.nvim

Map keys without delay when typing
GNU General Public License v3.0
629 stars 19 forks source link

Remove default bindings #73

Closed sho-87 closed 3 months ago

sho-87 commented 3 months ago

I use kj as escape, and Ive set that in my config but it seems all of the other default mappings are still in place. Ive had to assign jj, for example, to false to disable it. Still, a couple of problems with this:

  1. There is now a very slightly delay when pressing j consecutively as I think this plugin still needs to evaluate the mapping on every press?
  2. I have to manually disable all other default mappings for all modes (the config below only works for jj)

Could we get an option to disable default mappings altogether?

return {
  "max397574/better-escape.nvim",
  event = "InsertEnter",
  opts = {
    timeout = vim.o.timeoutlen,
    mappings = {
      i = {
        j = {
          j = false,
        },
        k = {
          j = "<Esc>",
        },
      },
      t = {
        j = {
          j = false,
        },
        k = {
          j = "<Esc>",
        },
      },
    },
  },
}
max397574 commented 3 months ago

I can add an option create_default_mappings which is true by default

For the other issue I have an idea why I can try later (nowait=true). But I can tell with absolute certainty that I'll be able to fix this

sho-87 commented 3 months ago

unsure if this is related, but one additional thing ive discovered is that in visual mode, pressing j quickly will Esc back to normal mode even though the binding has been disabled, also, weirdly, pressing k consecutively will also Esc out even though that is not in the default config at all

      v = {
        j = {
          j = false,
        },
        k = {
          j = "<Esc>",
        },
      },
max397574 commented 3 months ago

that issue should be fixed now @sho-87

Sam-programs commented 3 months ago

There is now a very slightly delay when pressing j consecutively as I think this plugin still needs to evaluate the mapping on every press?

Is this still an issue ?

max397574 commented 3 months ago

added a config option to disable the default mappings if you still have the other issue please open a separate issue for it