max397574 / better-escape.nvim

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

interferes with lazygit navigation #81

Closed thuvasooriya closed 3 months ago

thuvasooriya commented 3 months ago

not sure which update made the specific change but, navigation in lazygit is very hard due to the j key getting escaped for every two presses. (there is no concept of normal mode there i guess). a reliable solution would be great will open a similar issue ticket in lazygit repository as well.

max397574 commented 3 months ago

well that's because since the rewrite you can also map things in terminal mode and there were defaults added so you can just disable the terminal mappings if they are a problem for you

thuvasooriya commented 3 months ago

well that's because since the rewrite you can also map things in terminal mode and there were defaults added so you can just disable the terminal mappings if they are a problem for you

{
"max397574/better-escape.nvim",
event = "InsertEnter",
-- lazy = false,
config = function()
require("better_escape").setup {
default_mappings = false,
mappings = {
i = {
j = {
k = "<Esc>",
j = "<Esc>",
},
},
c = {
j = {
k = "<Esc>",
j = "<Esc>",
},
},
v = {
j = {
k = "<Esc>",
},
},
s = {
j = {
k = "<Esc>",
},
},
},
}
end,
},

@max397574 i'm using the above configuration and the issue is still there. am i doing something wrong

thuvasooriya commented 3 months ago

alright the issue is gone after i update the plugin with lazygit, thankyou for your time.

max397574 commented 3 months ago

glad I could help hint: when enabling default mappings and setting the terminal ones (or just jj) to false the config will be way simpler

cyaconi commented 3 months ago

This worked for me

  {
    "max397574/better-escape.nvim",
    event = "InsertEnter",
    config = function()
      require("better_escape").setup({
        default_mappings = true,
        mappings = {
          t = { false },
        },
      })
    end,
  },
thuvasooriya commented 3 months ago

t = {false}, didn't work for me for some reason, i settled on this config

  {
    "max397574/better-escape.nvim",
    event = "InsertEnter",
    config = function()
      require("better_escape").setup {
        mappings = {
          t = { j = { false } }, --lazygit navigation fix
          v = { j = { k = false } }, -- visual select fix
        },
      }
    end,
  },
max397574 commented 3 months ago

t = { false } actually also wasn't intended to work may also break in the future