workflow.nvim is a plugin to create and manage ASCII diagrams directly in neovim.
- 📦 Create boxes and containers with customizable dimensions
- ➡️ Draw arrows in multiple directions (horizontal, vertical, diagonal)
- 📐 Resize and reposition diagram elements
- 🔧 Built-in diagram templates
- 🎨 DSL support for complex diagram creation
- 📤 Export diagrams to Markdown
- ⌨️ Intuitive key mappings
Using packer.nvim:
use {
'franpfeiffer/workflow.nvim',
config = function()
require('workflow').setup({
-- optional configuration
})
end
}Using lazy.nvim:
{
'franpfeiffer/workflow.nvim',
config = function()
require('workflow').setup()
end
}require('workflow').setup({
default_box_width = 7, -- Default width for boxes
default_arrow_style = "-->", -- Default arrow style
templates = { -- Add custom templates
my_template = [[
+-----+
| Box |
+-----+
]]
}
}):AsciiBox- Create a box
+-------+
| |
+-------+
:AsciiArrow [direction]- Create an arrow (horizontal, vertical, diagonal)
Horizontal: ───►
Vertical: │
▼
Diagonal: ╲
╲
:AsciiResize- Resize the current box (prompts for dimensions):AsciiTemplate [name]- Apply a predefined template:AsciiGenerate [register]- Generate diagram from DSL:AsciiExport- Export diagram to Markdown
Built-in templates:
- Flow Template (
:AsciiTemplate flow):
+-------+ +-------+
| Start | -->| End |
+-------+ +-------+
- Decision Template (
:AsciiTemplate decision):
+-------+
| Start |
+-------+
│
+-------+
| Check |
+-------+
╱ ╲
+---+ +---+
|Yes| |No |
+---+ +---+
│ │
+----+ +----+
|smth| |smth|
+----+ +----+
Create diagrams using simple text commands:
box "Start"
arrow
box "Process"
arrow
box "End"
To use the DSL:
- Copy your DSL commands to a register (e.g., register 'a')
- Run
:AsciiGenerate a
Export your diagrams to Markdown:
- Create your diagram
- Run
:AsciiExport - Enter filename (defaults to diagram.md)
The diagram will be exported as a markdown code block:
+-------+ +-------+
| Start | -->| End |
+-------+ +-------+
-- Create a flow diagram using commands
:AsciiBox
-- Move cursor down
:AsciiArrow
-- Move cursor down
:AsciiBox
-- Result:
+-------+
| |
+-------+
───►
+-------+
| |
+-------+-- Copy to register 'a':
box "Input"
arrow
box "Process"
arrow "vertical"
box "Output"
-- Generate using:
:AsciiGenerate a
-- Result:
+-------+
| Input |
+-------+
───►
+-------+
|Process|
+-------+
│
▼
+-------+
|Output |
+-------+