Terminal Efficiency
You already know how fast and simple it is to create diagrams in PlantText. But you can make life even easier on yourself by using autocomplete and snippets to reduce repetitive typing. Coming from a Linux terminal background, I want to type as little as possible and be “lazy”! We used to call this terminal efficiency in the old days. Let’s explore how these features work to help you edit diagrams more quickly and with less effort…and never touching the mouse of course. In the diagram below you can see I typed “act”, which brings up both autocomplete items and a bunch of snippets.
First Things First: Settings
Autocomplete is turned on by default in Settings, so you should see it in action right away. You can turn it off by toggling the “Live autocompletion” item in the Settings window. Not sure why you’d want to, though!
Snippets is turned on by default as well but needs you to select the diagram type you want snippets for. You don’t want Class Diagram snippets popping up while you are working on an Activity Diagram. So, once again, go to the Settings window, toggle on the Snippets item, and then select the diagram type you wish to use from the drop-down list. OK, now we can get started talking about all this…
Autocomplete is just customized type-ahead
Autocomplete in PlantText works like the autocomplete features found in other programming IDEs. As you start typing, PlantText will suggest options that match what is already in the existing text. A drop-down list of options appears right next to the text and you can select an item with arrow keys and the tab button. This helps you find commands faster, makes it easier to get the syntax right, and reduces typos. For instance, typing the initial letters of a commonly used keyword like “int” in a Class Diagram might prompt PlantText to display suggestions that match those first three letters like “interface” or “instance” or whatever you have been using in the diagram.
Autocomplete & Snippets speed up diagram creation
Typing out each PlantUML command manually can be repetitive, especially for complex UML diagrams. Autocomplete in PlantText saves time by minimizing the amount of typing required. Instead of typing out entire commands, simply type a few letters and select the desired option from the list of suggestions.
Notice there are items in the drop-down that have the word “local” next to them…well these are autocomplete items. If you don’t have snippets turned on, you will only see these in the drop-down list. All the others items are snippets, which we will talk more about in a second.
Let’s say you’re working on an Activity Diagram and need to define various actors. Instead of typing “actor” for each new element, you can begin typing “act” and let Autocomplete fill in the rest. This small change can add up to significant time savings, particularly for users creating multiple diagrams or adding numerous components to a single design.
Snippets are pre-built code blocks
Snippets are another productivity-enhancing feature in PlantText. A snippet is a pre-built block of syntax that represents a commonly used structure, making it easy to insert standard patterns into your diagrams with just a click or keystroke. For example, if you often create Class Diagrams, snippets allow you to quickly add the classes, structures, and relationships to fill in the details relevant to your specific diagram.
Snippets can also help users who are new to PlantUML learn the syntax and familiarize themselves with the available options. By seeing suggested keywords, PlantUML syntax begins to embed itself in their minds.
PlantText provides various snippets for common UML structures. Using these snippets means you don’t have to remember the exact syntax for each structure; instead, you can focus on populating the template with relevant details. Also, notice that we are using a special prefix for each diagram type…in this case “cla-‘ for all of the Class Diagram snippets.
Imagine you’re creating a Class Diagram and need to define a standard class structure. Rather than typing out each line, you can select a “class” snippet that provides a template with placeholders for properties and methods. Once the snippet is inserted, you only need to fill in specific details for your design. Use the arrow keys and tab to select the snippet you want to use, then tab from one field to the next to add the name and other details to the snippet template.
Snippets can be particularly helpful for large, complex diagrams where multiple components follow similar patterns. By using snippets, you avoid repetitive typing, maintain consistency in your diagrams, and accelerate your workflow significantly.
Snippets are a work in progress
At present, PlantText currently offers snippets for three diagram types: Activity, Class and Component Diagrams. We will continue to add snippets to support other diagram types as we go along. Remember that typing the first three letters of a diagram type name will make all the snippets appear in the editor (act for Activity, cla for Class, and com for Component). If you have a certain diagram type you’d like us to prioritize, please email us or leave a comment here. And to see the full list of available snippets, go here.
To summarize
Autocomplete and Snippets in PlantText are game-changers for anyone who regularly creates diagrams, whether they’re seasoned pros or beginners. These features make diagramming faster, less prone to error, and more intuitive. By reducing repetitive work and providing quick access to syntax and templates, Autocomplete and Snippets let you focus on the structure and details of your diagrams, leaving the rest to PlantText.
Try experimenting with Autocomplete and Snippets the next time you use PlantText to see firsthand how much time they can save you. With these features in your toolkit, you’ll spend less time on syntax and more time bringing your ideas to life.