smoka7 / multicursors.nvim

A multi cursor plugin for Neovim.
MIT License
492 stars 15 forks source link

Insert Mode and Append do not work anymore! #101

Open MrMic opened 3 months ago

MrMic commented 3 months ago

Describe the bug When I switch to Insert Mode (with "i") or Append Mode with ("a") and I type letter(s) they only appear on the last selected text and not all! It is as if the other(s) selection(s) do not exist!

To Reproduce

Expected behavior Insert or append letter(s) in all selection(s)

Nvim version: v0.10.1

Multicursor version: "multicursors.nvim": { "branch": "main", "commit": "782820896b1691ed664e4c24f1cd9793dcb33dfb" }

I am working with AstroNvim but your plugin is loaded as is. It was working like a charm a few weeks ago...

DeadlySquad13 commented 1 month ago

Unfortunately, stumbled upon the same problem… Tried syncing all plugins and updating neovim to nightly and now the error occurs:

   Error  8:14:47 PM msg_show.lua_error Error executing Lua callback: ...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:66: attempt to index field 'normal_hydra' (a nil value)
stack traceback:
    ...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:66: in function 'new_under_cursor'
    ...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:28: in function <...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:27>
   Error  8:12:51 PM msg_show.lua_error Error executing Lua callback: ...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:60: attempt to index field 'normal_hydra' (a nil value)
stack traceback:
    ...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:60: in function 'start'
    ...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:20: in function <...im-data/lazy/multicursors.nvim/lua/multicursors/init.lua:19>
   Error  8:12:37 PM notify.error vim-illuminate: An internal error has occured: false"...ightly/current/share/nvim/runtime/lua/vim/treesitter.lua:201: attempt to call method 'range' (a nil value)"
   Error  8:12:37 PM notify.error lazy.nvim Failed to run `config` for multicursors.nvim

vim/shared.lua:764: s: expected string, got number (1)

# stacktrace:
  - vim\shared.lua:1002 _in_ **validate**
  - vim\shared.lua:764 _in_ **startswith**
  - vim\_init_packages.lua:76 _in_ **__index**
  - vim\shared.lua:692 _in_ **islist**
  - vim\shared.lua:360 _in_ **can_merge**
  - vim\shared.lua:377 _in_ **tbl_deep_extend**
  - hydra.nvim\lua\hydra\layer\init.lua:116 _in_ **initialize**
  - hydra.nvim\lua\hydra\lib\class.lua:14 _in_ **Layer**
  - hydra.nvim\lua\hydra\init.lua:437 _in_ **_setup_pink_hydra**
  - hydra.nvim\lua\hydra\init.lua:281 _in_ **initialize**
  - hydra.nvim\lua\hydra\lib\class.lua:14 _in_ **Hydra**
  - multicursors.nvim\lua\multicursors\layers.lua:196 _in_ **create_normal_hydra**
  - multicursors.nvim\lua\multicursors\init.lua:108 _in_ **setup**

I suppose author of multicursors assumed specific version of hydra? But I don't see it pinned anywhere in README or help file.

smoka7 commented 1 month ago

I'm on https://github.com/nvimtools/hydra.nvim/commit/7f5341643107d05a8d7d4fdea00b29af28517380 and nvim nightly, still cant reproduce this.

MrMic commented 1 month ago

I am with the stable release: 3ced42c And I am with AstroNvim

smoka7 commented 1 month ago

Try using the https://github.com/nvimtools/hydra.nvim as dependency.

MrMic commented 1 month ago

I just did it but that did not fix the issue... but I try what @smoka7 said:

return {
  "smoka7/multicursors.nvim",
  event = "VeryLazy",
  dependencies = {
    "nvimtools/hydra.nvim",
    commit = "7f5341643107d05a8d7d4fdea00b29af28517380",
  },
  opts = {},
  cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" },
  keys = {
    {
      mode = { "v", "n" },
      "<Leader>mM",
      "<cmd>MCstart<cr>",
      desc = "Create a selection for selected text or word under the cursor",
    },
  },
}

And it works again! 😌

@smoka7 are you able to update your hydra package? Thanks.

Rgds,

rachartier commented 1 month ago

I tried @MrMic fix, but it does not work on my setup.

nvim nightly (g3b54acdc6c)
nvimtools/hydra.nvim (7f53416)
multicursors.nvim (562809a)
MrMic commented 1 month ago

@rachartier My nvim is a stable version: v0.10.1

Capture d’écran du 2024-09-24 18-34-18

I hope it may help you.

jamestrew commented 1 month ago

Yeah works on neovim v0.10.1 but on nightly 0.11 the error from above pops up