Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with LazyVim setup #84

Open
LosChill opened this issue Mar 1, 2023 · 8 comments
Open

Trouble with LazyVim setup #84

LosChill opened this issue Mar 1, 2023 · 8 comments

Comments

@LosChill
Copy link

LosChill commented Mar 1, 2023

I am trying to set up magma with LazyVim. Any help would be appreciated for basic configuration. I have magma installed in its own /nvim/lua/plugins/magma.lua file. The file only contains the basic installation:
return{
{
"dccsillag/magma-nvim",
},
}

I have not configured any custom keys yet. Magma appears in LazyVim as "Loaded". Checkhealth shows everything is ok.

The problem is that I cannot run any :Magma commands.

For example, in Normal mode, running :MagmaInit
returns this error:
E492: Not an editor command: MagmaInit

I apologize if this is a trivial issue and super obvious. I just need some help. Any help would be appreciated. Thank you.

@qawdees
Copy link

qawdees commented Mar 1, 2023

Have you checked whether the plugin is actually loaded? You can do so by checking the LazyVim dashboard (<leader>l and H if your keymaps are still the default) and by executing :checkhealth.

If the plugin is not loaded you may want to adjust the LazyVim configuration a little to load it according to your needs. For debugging you can just change it to:

return{
  {
    "dccsillag/magma-nvim",
    lazy = false,
  },
}

This should force the plugin to be loaded. Afterwards you can check the dashboard and :checkhealth again.

You may also want to check whether your python provider is correctly setup and all the dependencies from here are installed properly.

By the time, support for ueberzug has been dropped. You have to install ueberzug-bak instead.

@LosChill
Copy link
Author

LosChill commented Mar 1, 2023

Thanks for the reply. Adding lazy = false didn't help. But ueberzug may be the issue. I do not have that dependency. And it doesn't seem like I can get it. Is there an alternative? Or a way around it?

@gcanat
Copy link

gcanat commented Mar 25, 2023

If lazy.nvim confirms that the plugin is loaded but you dont have the MagmaInit command available, it is probably an issue with UpdateRemotePlugins not correctly updating ~/.local/share/nvim/rplugin.vim.

@elliottgreen
Copy link

I've gotten this working under Lazy.nvim.
@dccsillag, would you mind if I sent you a pull request adding an 'example config' for Lazy?

Either way, thanks for this plugin, I really needed it!

@datacubeR
Copy link

@elliottgreen would you share what is the config used to make it work with Lazy.nvim?

@elliottgreen
Copy link

@datacubeR

I sent a PR #94 with what I did added to the README.md.
My apologies, I sent two PRs.
#94 is signed properly.

Thanks again for a great plugin!

@pavelskipenes
Copy link

pavelskipenes commented Feb 20, 2024

Could I get some help? I cannot get this to work

lazy configutation:

  {
    "dccsillag/magma-nvim",
    version = "*",
    lazy = false, -- workaround while debugging other stuff
    ft = { "ipynb" },
    keys = {
      {
        "<leader>mi",
        "<cmd>MagmaInit<CR>",
        desc = "This command initializes a runtime for the current buffer.",
      },
      { "<leader>mo", "<cmd>MagmaEvaluateOperator<CR>", desc = "Evaluate the text given by some operator." },
      { "<leader>ml", "<cmd>MagmaEvaluateLine<CR>",     desc = "Evaluate the current line." },
      { "<leader>mv", "<cmd>MagmaEvaluateVisual<CR>",   desc = "Evaluate the selected text." },
      { "<leader>mc", "<cmd>MagmaEvaluateOperator<CR>", desc = "Reevaluate the currently selected cell." },
      { "<leader>mr", "<cmd>MagmaRestart!<CR>",         desc = "Shuts down and restarts the current kernel." },
      {
        "<leader>mx",
        "<cmd>MagmaInterrupt<CR>",
        desc = "Interrupts the currently running cell and does nothing if not cell is running.",
      },
    },
  }

:checkhealth magma-nvim

magma: health#magma#check

requirements ~
- OK NeoVim >=0.5
- ERROR magma-nvim requires a Python provider to be configured!

Everything is being run inside a virtual environment with requirementes.txt:

pynvim
jupyter_client
ueberzug_bak

From the terminal inside neovim:

~/Repositories/Project> which python                                                     02/20/24 16:06:49 PM
╭───┬─────────┬──────────────────────────────────────────────────────────────────────────┬──────────╮
│ # │ command │                                   path                                   │   type   │
├───┼─────────┼──────────────────────────────────────────────────────────────────────────┼──────────┤
│ 0 │ python  │ /home/pavel/Repositories/Project/venv/bin/python                         │ external │
╰───┴─────────┴──────────────────────────────────────────────────────────────────────────┴──────────╯
~/Repositories/Project> python --version                                                 02/20/24 16:07:00 PM
Python 3.11.7
~/Repositories/Project> python3 --version                                                02/20/24 16:07:43 PM
Python 3.11.7
~/Repositories/Project> which python3                                                    02/20/24 16:07:50 PM
╭───┬─────────┬───────────────────────────────────────────────────────────────────────────┬──────────╮
│ # │ command │                                   path                                    │   type   │
├───┼─────────┼───────────────────────────────────────────────────────────────────────────┼──────────┤
│ 0 │ python3 │ /home/pavel/Repositories/Project/venv/bin/python3                         │ external │
╰───┴─────────┴───────────────────────────────────────────────────────────────────────────┴──────────╯
~/Repositories/Project>                                                                  02/20/24 16:07:56 PM

Related issues:
#118
Running :UpdateRemotePlugins return
E492: Not an editor command: UpdateRemotePlugins
#84 and #94
Lazy config is based on this PR

@buck-ross
Copy link

buck-ross commented Mar 3, 2024

  • ERROR magma-nvim requires a Python provider to be configured!

@pavelskipenes You must configure NeoVim's python provider in order to support plugins written in python (including magma-nvim). Adding the following lines to your init.lua script should do the trick:

vim.g.python3_host_prog = vim.fn.exepath 'python3'
vim.g.loaded_python3_provider = nil

Once you've added those lines & restarted NeoVim, you should then reach the same point as the rest of us - IE, :checkhealth reports no errors, but :MagmaInit and similar commands will not be available due to this bug. If you find a workaround, please post it here - I'm still unable to use the plugin because of this.


UPDATE: I figured out the missing piece this morning - I did not have remote plugins properly configured. After adding vim.cmd('runtime! plugin/rplugin.vim') to my init.lua script, and running the :UpdateRemotePugins command, everything appears to work perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants