brenton-leighton / multiple-cursors.nvim

A multi-cursor plugin for Neovim that works in normal, insert/replace, or visual modes, and with almost every command
Apache License 2.0
152 stars 4 forks source link

Error pressing Enter creates a new cursor #61

Closed GustavoJCL closed 1 month ago

GustavoJCL commented 1 month ago

Hi, when I'm in insert mode or normal, every time i press the Enter key, the plugin creates a new cursor down, this is my config:

{
    'brenton-leighton/multiple-cursors.nvim',
    lazy = true,
    event = 'VeryLazy',
    opts = function(_, opts)
      local wk = require 'which-key'
      wk.register({
        ['<leader>'] = {
          m = {
            name = '󱢓 Multiple cursors',
            a = { '<Cmd>MultipleCursorsAddMatches<CR>', 'Add Matches' }, -- f = { "<cmd>Telescope find_files<cr>", "Find File" },
            A = { '<Cmd>MultipleCursorsAddMatchesV<CR>', 'Add Matches (Limited by Visual Area)' },
            j = { '<Cmd>MultipleCursorsAddJumpNextMatch<CR>', 'Jump Next Add Match' },
            n = { '<Cmd>MultipleCursorsJumpNextMatch<CR>', 'Jump Next Match' },
            t = { '<Cmd>MultipleCursorsLockToggle<CR>', 'Toggle Lock or Unlock Multiple Cursors' },
          },
        },
      }, { mode = { 'n', 'v' } })
      wk.register({
        ['<C-n>'] = {
          '<Cmd>MultipleCursorsAddDown<CR>',
          'Add Multiple Cursors Down',
        },
        ['<C-m>'] = {
          '<Cmd>MultipleCursorsAddUp<CR>',
          'Add Multiple Cursors Up',
        },
        --['<C-LeftMouse>'] = {
        --'<Cmd>MultipleCursorsMouseAddDelete<CR>',
        --'Add Multiple Cursors with Mouse',
        --},
      }, { mode = { 'n', 'i' } })
      return opts
    end,
  },

image

brenton-leighton commented 1 month ago

I think the issue is that you are using Ctrl+m, which terminals also use for carriage return. You need to map it to something else.

Also I don't think you need to use wk.register(), which-key can detect the mappings automatically.

GustavoJCL commented 1 month ago

thanks, it solved my problem