ghostbuster91 / nvim-next

Apache License 2.0
29 stars 6 forks source link

`f`/`F`/`t`/`T` repeat not working since the last commit #24

Closed stevenxxiu closed 1 month ago

stevenxxiu commented 2 months ago

Since the last commit https://github.com/ghostbuster91/nvim-next/commit/50b639da68d9a132bac07c7e99a999a8ed47065f, repeats with f/F/t/T isn't working for me.

My config is:

opts = function()
  local next_builtins = require('nvim-next.builtins')

  return {
    default_mappings = {
      repeat_style = 'original',
    },
    items = {
      next_builtins.f,
      next_builtins.t,
    },
  }
end

Only using ; in repeat_last_move() and only using , in repeat_last_move_opposite() appears to make things work, but I didn't take a closer look to see what's actually going wrong.

Another issue is that I get the warning:

nvim-next: map builtin_T_expr with {expr=true} instead.

ghostbuster91 commented 2 months ago

nvim-next: map builtin_T_expr with {expr=true} instead.

This is supposed to appear only if you bind accidentally builtin functions without passing opts.expr=true.

Builtin functions do set this in their definition here. And this is passed into the vim.keymap.set in here.

Are you sure that you are not binding f/F etc yourself somewhere else?

stevenxxiu commented 2 months ago

I checked and I'm not binding it somewhere else:

:nmap
...
n  F           * <Lua 491: ~/.local/share/nvim/lazy/nvim-next/lua/nvim-next/builtins/functions.lua:15>
                 nvim-next: builtin f/F
...

I removed all my plugins except next, and this still occurs.

I see in https://github.com/ghostbuster91/nvim-next/blob/417b47634df9d59f69d1ce7148e9e95c7b6f7197/lua/nvim-next/builtins/functions.lua#L5 there's:

M.builtin_f_expr = function()
    vim.notify_once("nvim-next: map `builtin_T_expr` with `{expr=true}` instead.", vim.log.levels.WARN)
    move.last_move = {
        func = "f",
        opts = { forward = true },
        additional_args = {},
    }
    return "f"
end

Shouldn't this function run every time f is pressed anyway? I don't get why there's the notify here.

stevenxxiu commented 1 month ago

Appears to be fixed by #26 indeed.