Closed Roudranil closed 1 year ago
try this snippet
require('yarepl').setup {
buflisted = true,
scratch = true,
ft = 'REPL',
wincmd = 'vertical 70 split',
metas = {
ipython = {
cmd = '/path/to/ipython --no-autoindent',
formatter = yarepl.formatter.bracketed_pasting
}
},
close_on_exit = true,
scroll_to_bottom_after_sending = true
}
Thanks! that fixed it. However it is a bit weird. I usually setup plugins in this way with lazy.nvim
'milanglacier/yarepl.nvim',
opts = function() require("plugins.configs.yarepl") end,
init = function() require("core.utils").load_mappings("yarepl") end,
config = function(_, opts)
require("yarepl").setup(opts)
end,
ft = {"python"}
with the above config being returned from plugins.configs.yarepl
. With your suggestion i just pasted the table in place of opts and it works. Any idea why?
Also, i would like to keep the python file bython file buffer as the current one and not switch focus to the repl window. Any idea on how to do it?
Fixed the focus switching one.
Thanks! that fixed it. However it is a bit weird. I usually setup plugins in this way with
lazy.nvim
'milanglacier/yarepl.nvim', opts = function() require("plugins.configs.yarepl") end, init = function() require("core.utils").load_mappings("yarepl") end, config = function(_, opts) require("yarepl").setup(opts) end, ft = {"python"}
with the above config being returned from
plugins.configs.yarepl
. With your suggestion i just pasted the table in place of opts and it works.
I don’t use so many "advanced" config options from lazy. I consider them as over-encapsulation.
I think only three config options from lazy are enough for configuring yarepl (if you want to lazy load).
The first is init
where you can preload your keymaps, the second is cmd
where you should put the commands from yarepl into this list, the last is config
where you should call like this config = function() require 'yarepl'.setup { your config is here } end
inside this function.
If you don’t do lazy load, then cmd
can be ignored.
Two things to note:
You must call the setup
function in yarepl to make it functional, this is the convention of neovim lua plugin.
you can’t use opt
option in lazy because you are using some objects fromyarepl
(notably formatter.bracketed_pasting
) which is only available after you have require “yarepl”
, so you should put them under config
part.
Setting
wincmd = "vertical 70 split
does not result in opening of the REPL window in the said position. It still opens in the default position.Current config:
Looking at the source code, in the repl_start part, i dont see the wincmd option being used anywhere (I maybe wrong). Any ideas?