Vigemus / iron.nvim

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

preferred binary not working (ipython) #145

Open danjenson opened 4 years ago

danjenson commented 4 years ago

iron.lua:

local iron = require("iron")

iron.core.set_config {
  preferred = {
    python = "ipython"
  },
  repl_open_cmd = "topleft vertical split",
}

_G.my_iron_open_fn = function(orientation)
  local old_config = iron.config.repl_open_cmd
  iron.core.set_config{repl_open_cmd = orientation}
  iron.core.repl_for(vim.api.nvim_buf_get_option(0, "ft"))
  iron.core.set_config{repl_open_cmd = old_config}
end

in init.vim:

Plug 'Vigemus/iron.nvim', {'do': ':UpdateRemotePlugins'}
...
if filereadable(expand('~/.config/nvim/iron.lua'))
  luafile $HOME/.config/nvim/iron.lua                                   
  nmap B <Cmd>lua my_iron_open_fn("rightbelow split")
  nmap L <Cmd>lua my_iron_open_fn("topleft vertical split")
endif

At first I thought it might be looking for ipython in the system libraries instead of my venv, so I provided the path to the ipython binary for the venv. That didn't work, so I also installed ipython system-wide, and it still didn't open ipython.

hkupty commented 4 years ago

That's weird. One thing could be the way that you're starting your nvim process - if it's spawned from the command line or through a gui directly. If the latter, maybe it's not inheriting the $PATH variable.