Category Archives: Python

LoremText plugin for Sublime Text

Sublime Text is a cross-platform text and source code editor. It attracted a lot of users since the stable version 2 had been released last year, and I really love it!

Sublime Text has an elegant user interface, it also provides a number of awesome functionalities, such as multiple selection, go to anything, file palette, vintage mode, etc.

We all know that every powerful editor has a strong plugin system, and Sublime Text is no exception. Sublime Text has a python based plugin system, If you have interests in writing a Sublime Text plugin, you can read this article How to Create a Sublime Text 2 Plugin .

There are already more than 1000 plugins in the Package Control plugin management system for Sublime Text. Of course, this one named “LoremText” which is written by myself is one of them. The source code for “LoremText” is maintained on github, you can download code from this page https://github.com/ccpalettes/sublime-lorem-text.

LoremText is a plugin for sublime text 2 that generates random or fixed lorem ipsum text. Lorem ipsum is commonly used as placeholder text before you have the real meaningful content. Think back, if you are a designer there must be a lot of times that you designed a page, but no one told you the real meaningful text to be filled into the content blocks. If you are a programmer, there must be also a lot of times that you need a large string, but you use repeated “abcdefg123456” instead. Ha, lay aside those bad habits from now on, cause lorem ipsum will help you.

Below is a sample text of lorem ipsum. Although, we all have no idea of the meaning of this paragraph, but you still can consider it as some kind of human language.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

LoremText is exactly a plugin to create lorem ipsum pattern text. It has a word dictionary which contains more than two thousand words. After you installing it into your Sublime Text editor, you can execute it from command palette, edit menu, or just press the shortcut key alt+l. The GIF picture below shows how to use the LoremText plugin. 

LoremText Example

An advantage of LoremText is that it could create any number of words or paragraphs exactly you want. LoremText could recognize the lorem text expression which is defined by itself. The style of lorem text expression is like a function call, the pattern of the expression is lorem({word_count}, {paragraph_count}).  Parameter “word_count” represents how many paragraphs to be inserted and parameter “paragraph_count” represents how many words that each paragraph contains. For example, lorem(100, 3) means that it will create three paragraphs of lorem ipsum text and each paragraph contains one hundred words. Both the two parameters are optional,if you leave them empty, the plugin will use default values that are configured in the settings file. So lorem(,5) will use default word count for five paragraphs in the settings, lorem() will use default values for both parameters, actually, if you want to use default values, you don’t need to input lorem(), just press “alt+l“, lorem ipsum text will be inserted after the mouse cursor automatically.

With the help of multiple selection feature in Sublime Text, you can insert multiple lorem ipsum blocks at the same time. but keep in mind, the mouse cursor must be within the region of the lorem text expressions.