Vigemus / iron.nvim

Interactive Repl Over Neovim
BSD 3-Clause "New" or "Revised" License
1.01k stars 81 forks source link

Facing Error #294

Open xllvrr opened 2 years ago

xllvrr commented 2 years ago

System: Arch Linux Neovim Version: 0.7.2-3

Expected Behavior: No issues when opening nvim Actual Behavior: When opening nvim I got this error

Error detected while processing /home/xllvr/.config/nvim/init.lua:
E5113: Error while calling lua chunk: .../nvim/site/pack/packer/start/iron.nvim/lua/iron/vie
w.lua:200: attempt to call field 'deprecate' (a nil value)
stack traceback:
        .../nvim/site/pack/packer/start/iron.nvim/lua/iron/view.lua:200: in function '__index'
        /home/xllvr/.config/nvim/lua/plugin/iron.lua:22: in main chunk
        [C]: in function 'require'
        /home/xllvr/.config/nvim/init.lua:13: in main chunk

This seems to be a rather recent change as I didn't seem to have this problem beforehand

Configuration for Iron:

---- IRON-REPL ----------------------------------------------------------------
local iron = require('iron')

iron.core.setup {
    config = {
        -- Highlights the last sent block with bold
        highlight_last = "IronLastSent",
        -- If iron should expose `<plug>(...)` mappings for the plugins
        should_map_plug = false,
        -- Whether a repl should be discarded or not
        scratch_repl = true,
        -- Automatically closes the repl window on process end
        close_window_on_exit = true,
        -- Your repl definitions come here
        repl_definition = {
            sh = {
                command = { "zsh" }
            },
            python = require("iron.fts.python").ipython
        },
        -- Repl position
        repl_open_cmd = require("iron.view").curry.right(function()
            return math.ceil(vim.o.columns / 2)
        end),
    },
    -- Iron doesn't set keymaps by default anymore. Set them here
    -- or use `should_map_plug = true` and map from you vim files
    keymaps = {
        send_motion = "<space>sc",
        visual_send = "<space>sv",
        send_line = "<space>sl",
        send_mark = "<space>s.",
        cr = "<space>s<cr>",
        interrupt = "<space>s<space>",
        exit = "<space>sq",
        clear = "<space>cl",
    }

}
tristone13th commented 2 years ago

Same problem.

jduc commented 2 years ago

Hey, I think this comes from a recent change in the view API. You can check the new way of sizing REPL at the end of the doc https://github.com/hkupty/iron.nvim#repl-windows. So basically replace those lines

    repl_open_cmd = require("iron.view").curry.right(function()
        return math.ceil(vim.o.columns / 2)
    end),`
xllvrr commented 1 year ago

Just came back to this as I've been rather busy with other stuff and so just disabled this for the time being but I have tried both repl_open_cmd = view.split(.5) and repl_open_cmd = view.split("50%") as replacement methods as per the wiki and both of them generate the same error

Error detected while processing /home/xllvr/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/xllvr/.config/nvim/lua/plugin/iron
.lua:26: attempt to call field 'split' (a nil value)
stack traceback:
        /home/xllvr/.config/nvim/lua/plugin/iron.lua:26: in main chunk
        [C]: in function 'require'
        /home/xllvr/.config/nvim/init.lua:13: in main chunk