I want to bind a key that will open a new terminal running ipython in a vertical split. So far I have figured out opening a new terminal in vertical split:

local map = vim.api.nvim_set_keymap
opts = {noremap = true, silent = true)

map('n', '<Leader>i', ':vsplit | terminal<CR>, opts)

How do I start ipython?

2 Answers 2


I would do:

local map = vim.api.nvim_set_keymap
opts = {remap = false, silent = true)

map('n', '<Leader>i', ':vsplit | terminal ipython<CR>a, opts)

The a makes that after starting the Neovim terminal it switch to Insert mode to let the user start editing its statements.

  • I tested this and it works properly thankyou. I figured another way of doing it before you answered and I have posted that one also. In your answer I don't understand what the 'a' is doing exactly after <CR>. Commented Apr 26 at 13:59
  • Thanks for the feedback :-). I have adapted the solution to explain the a part. Commented Apr 26 at 14:02

I was able to do it using

map('n', '<Leader>i', ':vsplit term://ipython --no-confirm-exit<CR>', opts)

I honestly don't even know how it works but it does. I just copied it from someone's github repository.

  • 1
    :help :terminal (maybe :helpgrep term:// for neovim)—the documentation is thorough for those cases when you don't understand something.
    – D. Ben Knoble
    Commented Apr 26 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.