Major mode for PlantUML files.
Supports
- Xref navigation of component definitions & references within the same file
- Generating png preview files using the plantuml jar & java
Adds the following keybindings
| Keybinding | Feature |
|---|---|
| C-c C-c | Compile diagram to check for errors |
| C-c C-p | Generate diagram preview |
| C-c C-o | Generate diagram preview & open in external image viewer |
| C-c ! | Select diagram type when starting a diagram |
| C-c i | Insert a deployment diagram element with automatic alias generated |
| C-c u | Insert a stdlib cloud element (AWS/Azure/GCP) |
| C-c I | Insert archimate element |
| C-c l | Insert archimate relationship between existing archimate elements in the buffer |
| C-u C-c i | Insert diagram element with prompt for alias |
| C-c a h | Add Draft header (Use C-u overwrite existing header) |
| C-c a f | Add footer based on the current date (Use C-u overwrite existing footer) |
| C-c a s | Add comment with the file name slug (Use C-u overwrite existing slug comment) |
| C-c a a | Add archimate sprite declaration |
| C-c e h | Enclose selection in <color> creole tag |
| C-c e s | Enclose selection in <size> creole tag |
| C-c e u | Remove any creole tag of the form <xxx>t|ext</xxx> when point is positioned inside the tag contents |
| C-c r | Converts a selection to a set of component declarations with automatic alias generated by prompting for the component type (Use C-u to put alias after description eg. for sequence diagram participants) |
| C-c R | Converts the lines in a selected region to Archimate elelements |
| M-<up> | Move line up |
| M-<down> | Move line down |
| C-c c | Insert transparent rectangle container with dashed (Use C-u for dotted, C-u C-u for box) |
| C-j | Expand special like emmet mode (Alternate C-<return>). Use C-u for dashed & C-u C-u for dotted |
| C-c ' | Open included file when invoked from line with !include directive |
While there is already an excellent plantuml-mode available what is the reason of this package existing?
- Did not like
planutml-initloading language keywords for each session - Did not like preview buffer popping up new window distracting the diagramming session
- Wanted errors in plantuml compilation to be easily accessible via the compilation-mode
- Wanted quick creation of plantuml diagram components
- Wanted jump-to-definition & list-references within the file
- Wanted to save the generated diagrams instead of having to manually save them each time
-
Imenu listings for component definitions
-
Simple emmet-mode like completions for relationships eg.
a->b,c<-dexpands toa --> b a --> c b <-- d c <-- dRunning
C-u C-jon the same expression results ina ..> b a ..> c b <.. d c <.. dRunning
C-u C-u C-jon the same expression results ina ~~> b a ~~> c b <~~ d c <~~ d -
Convert region of text to component type declarations eg. selecting the following lines
Frontend API Data BaseAnd running
plantuml-convert-regionorC-c rand selectingcomponentfor component type results incomponent fa as "Frontend API" component db as "Data Base"While running
C-u C-c ron the same selection and selectingparticipantas the component type results inparticipant "Frontend API" as fa participant "Data Base" as dbAnd running
plantuml-archimate-convert-regionorC-c Rand selectingApplication_Componentfor component type results inApplication_Component(fa, "Frontend API") Application_Component(db, "Data Base") -
Add PlantUML fragments for header, title, footer and file name slug comment from prefix
C-c a -
Enclose selection in PlantUML with creole tags (color & size) from prefix
C-c e
-
Ensure a compatible Java Runtime Environment (JRE) is installed
-
Install the latest PlantUML jar file from https://github.com/plantuml/plantuml
-
Clone the repository into site-lisp in the emacs user directory
git clone https://github.com/xshyamx/simple-plantuml-mode \ $HOME/.emacs.d/site-lisp/simple-plantuml-mode -
Add to
load-path(add-to-list 'load-path (expand-file-name "site-lisp/simple-plantuml-mode" user-emacs-directory))
-
Load & configure
(require 'plantuml-mode) (setq plantuml-java-cmd "java" plantuml-jar-path (expand-file-name "~/.m2/repository/net/sourceforge/plantuml/plantuml/1.2022.12/plantuml-1.2022.12.jar"))