A Neovim plugin for creating, rendering, and previewing UML diagrams directly from .puml
files. This plugin integrates with PlantUML and provides an efficient workflow for working with UML diagrams.
- Seamless UML Rendering: Automatically render UML diagrams from
.puml
files. - Auto-Refresh: Render diagrams on file save (optional).
- Cross-Platform Compatibility: Works on macOS, Linux, and Windows (planned future enhancements for non-macOS systems).
- Simple Workflow: Write UML in
.puml
files and preview the rendered diagrams with a single command.
-
PlantUML:
- Install PlantUML:
brew install plantuml # macOS sudo apt install plantuml # Ubuntu
- Ensure
plantuml
is available in yourPATH
.
- Install PlantUML:
-
Java:
- Install Java (required by PlantUML):
brew install openjdk # macOS sudo apt install default-jre # Ubuntu
- Install Java (required by PlantUML):
-
Neovim:
- Requires Neovim 0.8+ with Lua support.
Using packer.nvim:
use {
'Maduki-tech/nvim-plantuml',
config = function()
require('plantuml').setup({
output_dir = '/tmp',
viewer = 'open',
auto_refresh = true,
})
end
}
The plugin can be configured by calling the setup
function with the following options:
require('plantuml').setup({
output_dir = '/tmp', -- Directory to store rendered diagrams
viewer = 'open', -- Command to open rendered diagrams (e.g., `open` for macOS)
auto_refresh = true, -- Enable or disable auto-refresh on save
})
If no configuration is provided, the following defaults are used:
{
output_dir = '/tmp',
viewer = 'open',
auto_refresh = false,
}
Command | Description |
---|---|
:PlantUMLPreview |
Render and preview the current .puml file. |
-
Open or create a
.puml
file in Neovim:@startuml Alice -> Bob: Hello Bob Bob --> Alice: Hi Alice @enduml
-
Run the
:PlantUMLPreview
command to render and preview the diagram. -
Save the file (
:w
) to trigger auto-refresh (if enabled).
- Basic rendering of
.puml
files using PlantUML. - Auto-refresh support.
- Cross-platform compatibility for macOS.
- Improve error handling and diagnostics.
- Add support for opening rendered diagrams in platform-specific viewers (e.g., Windows Photo Viewer).
- Allow rendering to multiple formats (SVG, PDF).
- Add inline ASCII diagram previews in Neovim.
- Interactive UML editing directly within Neovim.
- Real-time rendering as you type.
- Syntax highlighting for
.puml
files. - Integration with external diagram storage services.
Ensure that plantuml
is installed and available in your PATH
. Test it by running:
plantuml -version
Install Java and ensure it is available in your PATH
. Test it by running:
java -version
Ensure the configured viewer
command works. Test it manually:
open /path/to/diagram.png # macOS
Contributions are welcome! If you encounter bugs or have feature suggestions, feel free to open an issue or submit a pull request.
This plugin is licensed under the MIT License. See the LICENSE file for details.