Some checks are pending
Check Lua Formatting in MyRepo / Stylua Check (push) Waiting to run
24 lines
745 B
Lua
24 lines
745 B
Lua
local M = {}
|
|
|
|
-- Function to check if an IPython REPL is open in Neovim panes
|
|
function M.is_ipython_open()
|
|
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
|
if vim.api.nvim_buf_is_loaded(bufnr) and vim.api.nvim_get_option_value('buftype', { buf = bufnr }) == 'terminal' then
|
|
if vim.b[bufnr].python_repl == true then
|
|
return true
|
|
end
|
|
|
|
-- Get first few lines to check if it's an IPython REPL
|
|
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 10, false)
|
|
for _, line in ipairs(lines) do
|
|
-- Specific checks for IPython
|
|
if line:match('IPython') or line:match('In %[%d+%]:') or line:match('In %[') then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
return M
|