Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mermaid.vim

A vim/neovim plugin providing syntax highlighting, indentation and filetype support for mermaid files (*.mmd, *.mermaid, *.mm).

printscreen of the terminal highlighting the mermaid file using eva01 colorscheme

Installation

lazy.nvim

{ 'mracos/mermaid.vim', ft = 'mermaid' }

What it covers

  • Every diagram type mermaid currently detects, taken from the detector regexes in its source rather than its docs site: flowchart, sequence, class, state, ER, gantt, pie, journey, gitGraph, requirement, quadrant, mindmap, timeline, kanban, C4, sankey, xychart, block, packet, treemap, treeView, radar, architecture, eventmodeling, ishikawa, venn, wardley, cynefin, swimlane, usecase, agentflow and railroad. Types that dropped their -beta suffix are recognised with and without it
  • YAML front matter and %%{init: ...}%% directives
  • Node shapes and link labels, sequence and class operators, ER cardinality, gantt dates and task tags, gitGraph attributes
  • Indentation for blocks, with else/and/option kept at the level of the branch they belong to, and blank lines no longer resetting the level
  • Diagrams whose indentation is the diagram itself (mindmap, ishikawa, treemap, treeView) or where reflowing buys nothing (sankey, packet, timeline) are left untouched by =

See :help mermaid for the details, including g:mermaid_detect_mm for the *.mm extension, which vim otherwise maps to objcpp/nroff.

Tests

No dependencies; the suite runs headlessly against both editors.

./test/run.sh                    # vim
EDITOR_BIN=nvim ./test/run.sh    # neovim
./test/run.sh indent_spec.vim    # a single spec

Contributing

Please do! Just send a Pull Request and I'll try to see it in due time. 😄

License

MIT, see LICENSE for more details.

About

Support of mermaid files to vim/neovim - work in progress

Topics

Resources

Stars

55 stars

Watchers

1 watching

Forks

Contributors

Languages