user19735492
user19735492

Reputation:

Neovim: "E492: Not an editor command"

I am trying to set up Neovim as an IDE for data science. I want to be able to execute highligted code blocks in a terminal session running IPython or R. For this I want to install the plugin iron.nvim.

The official readme suggests, that the terminal session can be launched with the command :IronRepl, but when I do this I get the error: E492: Not an editor command: IronRepl.

I've settled on using lazy.nvim as my package manager and have managed to install and apply a colourscheme correctly. This tells me, I am mostly doing this correctly.

I have bootstrapped lazy.nvim in ~/.config/nvim/init.lua as described in the official readme.

In the same file I have specified the location of the plugins-list to be loaded:

require("lazy").setup({
        import = "plugins"
    })

In ~/.config/nvim/lua/plugins/plugins.lua I have specified:

return {
    'hkupty/iron.nvim'
}

Running :Lazy reveals that the plugin has been installed correctly (and is in fact loaded). Running h: Iron opens the help pages, which also suggests it is correctly installed.

Any thoughts on how I can resolve this error?

I installed iron.nvim and tried to open a terminal session with the plugin as suggested in the official readme. I got an error message saying: E492: Not an editor command: IronRepl.

Upvotes: 2

Views: 7212

Answers (1)

TornaxO7
TornaxO7

Reputation: 1309

First of all: Welcome to stack overflow!

You're almost there! Take a look into the How to configure part of the README. The important lines are:

local iron = require("iron.core")

iron.setup {
    -- ...
}

The iron.setup function does the actual plugin-preparation which includes the commands which you'll be able to use afterwards. So you need to change your config as follows:

Instead of having

return {
    'hkupty/iron.nvim'
}

you'll need to change it to:

return {
    {
        'hkupty/iron.nvim',
        -- note that `init` will disable lazy-loading!
        init = function()
            local iron = require("iron.core")

            iron.setup({
                -- add the other options if you want
                config = {}
            })
        end
    }
}

Alternatively (which I suggest) you can make use of lazy-file-separation "feature" which allows you to declare a plugin in a separate file :) Take a look into Lazy's README for this case or you can take a look into my plugin directory.

Upvotes: 1

Related Questions