Using Plantuml from Vim

Posted on Feb 12, 2021

Creating diagrams is a great way to communicate with others. Writing in vim is a great way to communicate with yourself.

Combine them and it’s just great!

The resulting workflow: vim-plantuml-workflow

Just open a plantuml file and use :PlantumlOpen to launch a live reloading browser with the preview.

Pre-requisite software:

  • plantuml

Required plugins:

Plug 'aklt/plantuml-syntax'             " syntax hl for puml
Plug 'tyru/open-browser.vim'            " hooks for opeing browser
Plug 'weirongxu/plantuml-previewer.vim' " previewer

If you (like me) just love some ascii art, use the entr or similar here:

λ find . -name comp.puml | entr cat comp.puml | plantuml -tutxt -pipe

,---------.   ,----------.
|Component|   |Interface2|
|---------|   |----------|
|---------|---|----------|
'---------'   '----------'
      |
      |
,----------.
|Interface1|
|----------|
|----------|
'----------'

Resources: