This directory contains the Neovim integration for Manim Studio, providing a comprehensive development environment for creating animations with YAML configurations.
Language Server Protocol implementation providing:
- Syntax validation for YAML scene files
- Auto-completion for object types, animation types, and properties
- Hover documentation for configuration options
- Real-time error checking and diagnostics
Neovim plugin generator providing:
- Keybinding setup for common operations
- Command definitions for rendering and validation
- Integration scripts for seamless workflow
- Configuration management for plugin customization
Buffer synchronization and live preview system:
- Real-time buffer tracking and change detection
- Auto-rendering with configurable delays
- Live preview generation for quick feedback
- Validation callbacks for error reporting
pip install pygls # For LSP functionality# From the project root
python -m src.interfaces.cli.cli --interface nvim-pluginThis creates plugin files in ~/.config/nvim/lua/manim_studio/
Add to your Neovim configuration (lazy.nvim example):
{
"manim-studio",
dir = "~/.config/nvim/lua/manim_studio",
config = function()
require("manim_studio").setup()
end,
ft = {"yaml"},
cond = function()
return vim.fn.findfile('CLAUDE.md', '.;') ~= ''
end
}The LSP server starts automatically when editing YAML files in a Manim Studio project, or manually:
python -m src.interfaces.cli.cli --interface nvim-lsp-
Auto-completion for:
- Object types (circle, square, text, etc.)
- Animation types (fadein, fadeout, move, scale, etc.)
- Properties (position, color, duration, easing)
- Easing functions (linear, ease_in_out, bounce, etc.)
-
Hover documentation for all configuration options
-
Real-time validation with error highlighting
-
Diagnostics showing line-specific errors and warnings
:ManimRender [quality]- Render current scene:ManimPreview- Quick low-quality preview:ManimValidate- Validate YAML configuration:ManimInsertObject [type]- Insert object template:ManimInsertAnimation [type]- Insert animation template
<leader>mr- Render scene<leader>mp- Preview scene<leader>mv- Validate YAML<leader>mt- Toggle live preview<leader>mo- Insert object template<leader>ma- Insert animation template
require("manim_studio").setup({
lsp = {
enabled = true,
filetypes = {"yaml"},
},
keybindings = {
render_scene = "<leader>mr",
preview_scene = "<leader>mp",
},
preview = {
quality = "low",
auto_render = false,
update_delay = 2000 -- ms
}
})The LSP server can be started in different modes:
# Stdio (default for editors)
python -m src.interfaces.nvim.lsp_server
# TCP mode for debugging
python -m src.interfaces.nvim.lsp_server --tcp localhost 8088src/interfaces/nvim/
├── __init__.py # Module exports
├── lsp_server.py # LSP implementation
├── plugin.py # Neovim plugin generator
├── buffer_manager.py # Buffer and preview management
└── README.md # This file
The Neovim interface leverages the shared architecture:
- Uses
shared_corefor scene management and rendering - Integrates with YAML validator for real-time validation
- Follows the same patterns as MCP, GUI, and API interfaces
- Open a YAML scene file in Neovim
- Get auto-completion as you type object and animation definitions
- Use
<leader>mvto validate your configuration - Use
<leader>mpfor quick preview - Use
<leader>mrfor final render
-- Custom configuration
require("manim_studio").setup({
preview = {
auto_render = true, -- Enable auto-rendering
quality = "medium", -- Higher quality previews
update_delay = 1000 -- Faster response
}
})from src.interfaces.nvim.buffer_manager import BufferManager
# Create manager with auto-render
manager = BufferManager(auto_render=True, render_delay=2.0)
# Register a file
buffer_state = manager.register_buffer("scene.yaml")
# Update content (triggers validation and optional render)
manager.update_buffer("scene.yaml", updated_content)- Check
pyglsinstallation:pip install pygls - Verify Python path in LSP configuration
- Ensure you're in a Manim Studio project directory
- Restart LSP:
:LspRestart - Check LSP status:
:LspInfo - Verify file type detection:
:set ft?
- Check YAML validation first
- Verify Manim Studio installation
- Check output directory permissions
- Disable auto-render for large files
- Use "low" quality for previews
- Increase render delay
- Extend completion providers in
lsp_server.py - Add hover documentation for new properties
- Update validation in buffer manager
- Add command definition in
plugin.py - Implement corresponding Lua function
- Add keybinding if needed
# Test LSP server
python -m src.interfaces.nvim.lsp_server --tcp
# Test plugin generation
python -m src.interfaces.nvim.plugin generate
# Test buffer manager
python -m src.interfaces.nvim.buffer_manager scene.yamlThe Neovim interface works alongside other Manim Studio interfaces:
- MCP: Use MCP for programmatic scene creation, Neovim for manual editing
- GUI: Use GUI for visual scene building, Neovim for fine-tuning
- API: Use API for external integrations, Neovim for development
Planned features:
- Snippet support for common animation patterns
- Live preview pane within Neovim
- Debugging support for animation sequences
- Integration with Git for version control
- Collaborative editing features
- Performance profiling for complex scenes
When contributing to the Neovim interface:
- Follow the shared architecture patterns
- Update both Python and Lua components
- Add tests for new features
- Update documentation
- Consider backward compatibility