A small Neovim plugin to run Manim scenes directly from your editor. Pick the class under the cursor and play it in your terminal without leaving Neovim.
- Multi-core rendering for faster project exports. All files at once.
- Plays animations from the cursor.
- Detects the class under your cursor and ensures
import manimis present. - Checks for a valid
manimexecutable:- Uses system
manimif available (didn’t test). - Falls back to a provided virtual environment (
venv).
- Uses system
- Configurable play/export arguments.
You have to open terminal (toggleterm) for the first time.
This plugin has been tested with:
- Manim Community Edition v0.19.0
Using lazy.nvim:
{
"yeasin50/manim.nvim",
cmd = { "ManimCheck", "ManimPlay" , "ManimExport", "ManimExportProject", "ManimPlayFrom"},
ft = "python",
keys = {
-- modify as your will
-- { "<leader>c", "<cmd>ManimCheck<cr>", desc = "Check Manim availability" },
{ "<leader>m", "<cmd>ManimPlay<cr>", desc = "Play Manim class" },
},
config = function()
require("manim").setup({
manim_path = "manim", -- system binary
venv_path = "/home/...../manim/env", -- optional but if you are just using environment,provide full path
play_args = { "-pql" }, -- quality/preview args
export_args = {
"-qk",
"--media_dir=/home/..../manim_output",
"--transparent",
},
},
project_config = {
resolution = {3840, 2160}, -- width x height
fps = 60, -- frames per second
transparent = true, -- transparent background
export_dir = "/home/youruser/Videos/manim_exports", -- output directory
max_workers = 3, -- number of concurrent renders
ignore_files = {"common.py", "export.py"}, -- files to skip
failed_list_file = "failed_files.txt", -- log failures
}
)
end,
}- Open a Python file that contains Manim scenes.
- Make sure it has
import manimorfrom manim import ...at the top. - Place your cursor inside the class definition of the scene you want to render.
- Run one of the commands: or use keymap
| Command | Description |
|---|---|
:ManimCheck |
Verifies Manim is available (system binary or virtual environment). |
:ManimPlay |
Renders and plays the scene class under the cursor. |
:ManimPlayFrom |
Renders and plays the scene from the cursor line, injecting self.next_section(). |
:ManimExport |
Exports the scene under the cursor using export_args. |
:ManimExportProject |
Exports all scene files in the project using the Python export script and multi-core rendering. |
For project export make sure you are at the root of the project where it will have multiple python files.
from manim import *
class Title(Scene):
def construct(self):
self.add(Text("Hello from Manim!"))If your cursor is inside Title and you run:
:ManimPlayThe plugin will send this command to your terminal:
manim -pql test.py Title- project based configs
- Export multi-core
- play from cursor
- without toggleterm dependency(but I use it, so maybe I won't work on it
- ....