magma-nvim icon indicating copy to clipboard operation
magma-nvim copied to clipboard

[Bug] Cannot enter Operator mode with :MagmaEvaluateOperator with lazy.nvim

Open dtetruash opened this issue 1 year ago • 1 comments

Describe the bug I am unable to find the proper definition for the keymap settings for :MagmaEvaluateOperator within a lazy.nvim set up. The provided vimscript mapping for the same command given in README.md works.

To Reproduce Steps to reproduce the behavior:

  1. Use the following keymap (as per #94 and others):
    return {
      {
        "dccsillag/magma-nvim",
        version = "*",
        build = ":UpdateRemotePlugins",
        lazy = false,
        keys = {
          {
            "<leader>r",
            "<cmd>MagmaEvaluateOperator<CR>",
            desc = "Evaluate given operator",
            {
              noremap = true,
              expr = true,
              silent = true,
            },
          },
        },
      },
    
  2. Initialize a kernel in a buffer with :MagmaInit
  3. Try to evaluate a given paragraph of text with the cursor on it using <leader>rip
  4. See the character "p" be inserted at cursor instead of the paragraph being interpreted.

Note: Plugin works, is initialized correctly, and commands like :MagmaEvaluateLine work as expected.

Expected behavior The paragraph being evaluated as seen in the preview GIF in README.md

Desktop (please complete the following information):

  • OS: Linux/Manjaro
  • Version
NVIM v0.9.0-dev-1355+gb2d10aa01
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/home/runner/work/neovim/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include

  system vimrc file: "$VIM/sysinit.vim"
 fall-back for $VIM: "/share/nvim"

dtetruash avatar Aug 09 '23 12:08 dtetruash

Describe the bug I am unable to find the proper definition for the keymap settings for :MagmaEvaluateOperator within a lazy.nvim set up. The provided vimscript mapping for the same command given in README.md works.

To Reproduce Steps to reproduce the behavior:

  1. Use the following keymap (as per Add LAzyVim config options to README and sign it #94 and others):
    return {
      {
        "dccsillag/magma-nvim",
        version = "*",
        build = ":UpdateRemotePlugins",
        lazy = false,
        keys = {
          {
            "<leader>r",
            "<cmd>MagmaEvaluateOperator<CR>",
            desc = "Evaluate given operator",
            {
              noremap = true,
              expr = true,
              silent = true,
            },
          },
        },
      },
    
  2. Initialize a kernel in a buffer with :MagmaInit
  3. Try to evaluate a given paragraph of text with the cursor on it using <leader>rip
  4. See the character "p" be inserted at cursor instead of the paragraph being interpreted.

Note: Plugin works, is initialized correctly, and commands like :MagmaEvaluateLine work as expected.

Expected behavior The paragraph being evaluated as seen in the preview GIF in README.md

Desktop (please complete the following information):

  • OS: Linux/Manjaro
  • Version
NVIM v0.9.0-dev-1355+gb2d10aa01
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/home/runner/work/neovim/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/.deps/usr/include

  system vimrc file: "$VIM/sysinit.vim"
 fall-back for $VIM: "/share/nvim"

I also encountered this issue, and I found a solution by defining the key mappings as follows:

  vim.cmd[[
  nnoremap <expr><silent> <Leader>r  nvim_exec('MagmaEvaluateOperator', v:true)
  ]]

If you have any better solutions, I would appreciate it if you could share them with me.

yunus-sun avatar Dec 08 '23 08:12 yunus-sun