typst-preview.nvim icon indicating copy to clipboard operation
typst-preview.nvim copied to clipboard

Using keys other than escape, like `jk` or `jj` to <Esc> always leave the first character behind

Open westernwontons opened this issue 11 months ago • 3 comments

Steps to reproduce:

  1. Bind jk to esc with map jk n j * v:count == 0 ? 'gj' : 'j'
  2. Open a typst document
  3. Type anything
  4. Press jk
  5. j is left behind

westernwontons avatar Feb 29 '24 21:02 westernwontons

Hello, sorry for the late reply and thanks for pointing this out.

It seems that I can not reproduce this issue. I have ,. imap to <Esc> as well and have never experienced similar issue. I am not sure how are you binding jk to esc. Following the command you provided: :map jk n j * v:count == 0 ? 'gj' : 'j' I can't seem to get jk mapped to esc. Do you have more details on how you're mapping jk to <Esc>? I am assuming your mapping it in insert mode.

chomosuke avatar Mar 25 '24 05:03 chomosuke

The plugin that I'm using is https://github.com/max397574/better-escape.nvim with the following config:

{
    "max397574/better-escape.nvim",
    opts = function(_, opts)
        opts.mapping = { "jk", "jK" }
        opts.timeout = 150
        return opts
    end
}

Exiting with <ESC> indeed doesn't reproduce this issue for me either

westernwontons avatar Mar 27 '24 14:03 westernwontons

Hello there,

I've installed better-escape.nvim but I still cannot reproduce your issue.

If you'd like, you can try to debug the issue yourself. One way to solve the issue could be to add more events to line 46 of lua/typst-preview/events/autocmds.lua.

chomosuke avatar Mar 31 '24 11:03 chomosuke

Please reopen this issue if the problem persist with the latest release

chomosuke avatar Oct 15 '24 10:10 chomosuke