nvim-repl

nvim-repl

Better REPLs in Neovim, supporting aider (AI), ipython, utop, and more!

Stars: 79

Visit
 screenshot

Neovim REPL is a tool that allows users to create, use, and remove interactive Read-Eval-Print Loops (REPLs) within Neovim. It supports various REPLs including aider, ipython, and utop. Users can easily send code cells, lines, or visual selections to the REPL. The tool provides default settings and allows for customization through Lua configuration. Documentation is available within Neovim's help file. Users can seamlessly integrate Neovim with aider for AI pair programming by following recommended configurations.

README:

Neovim REPL

Create, use, and remove interactive REPLs within Neovim.

Works with any REPL, but contains custom support for the following REPLs:

  • aider: AI pair programming in your terminal
  • ipython: a powerful interactive Python shell
  • utop: a much improved interface to the OCaml toplevel

Default REPL settings are defined in lua/repl/init.lua:defaults.

Demo

demo

Installation

Neovim REPL is a normal Neovim package.

lazy.nvim

Configuration for https://github.com/folke/lazy.nvim

Basic

{
  "pappasam/nvim-repl",
  keys = {
    { "<Leader>c", "<Plug>(ReplSendCell)",   mode = "n", desc = "Send Repl Cell" },
    { "<Leader>r", "<Plug>(ReplSendLine)",   mode = "n", desc = "Send Repl Line" },
    { "<Leader>r", "<Plug>(ReplSendVisual)", mode = "x", desc = "Send Repl Visual Selection" },
  },
}

Custom

{
  "pappasam/nvim-repl",
  opts = {
    filetype_commands = {
      javascript = {cmd = "deno repl", filetype = "javascript"},
    },
    default = {cmd = "bash", filetype = "bash"},
    open_window_default = "vertical split new",
  },
  keys = {
    { "<Leader>c", "<Plug>(ReplSendCell)",   mode = "n", desc = "ReplSendCell" },
    { "<Leader>r", "<Plug>(ReplSendLine)",   mode = "n", desc = "ReplSendLine" },
    { "<Leader>r", "<Plug>(ReplSendVisual)", mode = "x", desc = "ReplSendVisual" },
  },
}

FAQ

Where's the documentation?

Documentation is in a normal Neovim help file. You can read it online here.

From within Neovim, type :help repl.

Escape doesn't work in Terminal mode

If you find yourself in Terminal mode, use <C-\><C-n> instead of <Esc> to return to Normal mode.

Type :help Terminal-mode and :help CTRL-\_CTRL-N for more information.

Recommended aider configuration

The built-in aider integration overrides aider's --multiline, --notifications, and --notifications-command for a smooth Neovim integration. All other settings default to the user's aider configuration file and environment. To that end, we recommend:

  1. Use $AIDER_MODEL to specify your preferred model before opening Neovim.
  2. For other settings, please reference the Author's current aider configuration for inspiration.

My tabline is really long

Sometimes, terminal commands (like aider) can be long. If your tabline is long, you can customize it.

Click here for an example

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for nvim-repl

Similar Open Source Tools

For similar tasks

For similar jobs