Installing PlantUML
On Debian and derivatives, PlantUML can be installed with apt
:
sudo apt install plantuml
The version in Ubuntu 24.04 LTS is: 1.2020.2. This version includes the C4 diagrams in the so-called PlantUML Standard Library:
plantuml -version
plantuml -stdlib | grep -A2 'c4'
To test that it has been set up correctly, create a simple diagram definition:
cat > diag.puml <<EOF
@startuml
Alice -> Bob: test
@enduml
EOF
Generate the corresponding diagram in SVG format:
plantuml -tsvg diag.puml
xdg-open diag.svg
This version of PlantUML still uses the “rose” theme
and does not yet support the -theme
option.
But it is possible to render the diagram in black & white:
plantuml -Smonochrome=true diag.puml
Vim setup
To set up filetype detection, syntax highlighting, and the makeprg
variable,
install the aklt/plantuml-syntax
plugin:
mkdir -p ~/.vim/pack/plugins/start/
cd ~/.vim/pack/plugins/start/
git clone https://github.com/aklt/plantuml-syntax
Change the default output format from PNG to SVG with:
cat >> ~/.vimrc <<END
let g:plantuml_executable_script = 'plantuml -tsvg'
END
You can then generate the diagram for the file you’re editing from within Vim
by simply running :make
.