Introduction
Sublime Text has earned its place as one of the most popular text editors among developers and writers alike. Its speed, simplicity, and powerful features make it a favorite for anyone working with code or text on a daily basis. In this article, I’ll share some practical examples and useful tricks that can help you work faster and more efficiently in Sublime Text. These simple techniques can save you a surprising amount of time and make your workflow much smoother.
Trick summary
List into the lines with Sublime Text (trick2).
Find duplicates with Sublime Text (trick3).
Firstly, we would use the following strings of numbers:
188417
72
8512
251127
670
337970
524267
297450
8512
337970
It is just ten lines for brevity. But keep in mind that it can be hundreds and thousands of lines and the following Sublime Text tricks will take the same time!
Trick 1: Lines into the list
Converting multiple lines of text into a single line in Sublime Text can be extremely useful for several reasons:
Formatting for Code or Data: Sometimes you need to turn a list (like JSON arrays, SQL queries, or CSV entries) into a single line for easier copying, pasting, or sending through APIs.
Minimizing File Size: For configuration files, logs, or scripts, reducing unnecessary line breaks can make the file smaller and faster to process.
Preparing Input for Commands: Some tools and systems expect input in a single-line format, and converting text quickly can save you a lot of manual editing.
Cleaner Presentation: When you need to share short snippets of code or data in emails, chat messages, or documentation, a one-liner often looks cleaner and takes up less space.
So the data for our practice:
Initial lines
188417
72
8512
251127
670
337970
524267
297450
8512
337970
Expected output
['188417', '72', '8512', '251127', '670', '337970', '524267', '297450', '8512', '337970']

In Short, let’s explain what’s going on on the animation.
- Firstly, we start from selecting all lines using Ctrl-A keys combination.
- Then we press Shift-Ctrl-L for adding multiline cursor to the ends of lines
- Then we start editing our text. Home key puts multiline cursor to the begging of the lines. You can use Ctrl-Left and Ctrl-Right for words navigation.
The reasonable question: Can we do the same trick in another text editors like Notepad++? The answer is NO. We can do multiline selection in Notepad++ (Alt-Shift-Down or Alt-Shift-Up), but we can’t do multiline words navigation.
Trick 2: List into the lines with Sublime Text
Breaking a single long line into multiple lines can be incredibly helpful for several reasons:
Improved Readability: Firstly, long lines of code, text, or data can be hard to read and maintain. Splitting them into shorter, organized lines makes it much easier to understand.
Meeting Style Guidelines: Secondly, many programming languages and teams have style guides that limit line length (like 80 or 120 characters) for better readability and version control diffs.
Editing and Debugging: Likewise,iIt’s easier to spot errors, make edits, or update parts of text when it’s split logically across multiple lines. For example in Debian KVM article.
Preparing Data: When working with lists, SQL queries, or structured data, multi-line formatting can make it easier to add, remove, or modify entries.
Better Version Control: Moreover, changes in multi-line files are easier to track with tools like Git, where small differences are clearly visible.
We are going to make reverse operation from the Trick 1. But we make the task harder. Moreover, we add some tabs, spaces and endlines as separator.
Initial lines
['188417', '72', '8512' , '251127',
'670' , '337970', '524267',
'297450', '8512', '337970']
Expected output
188417
72
8512
251127
670
337970
524267
297450
8512
337970

Let’s see how we have done that:
- Firstly, We started from find by pressing Ctrl+F
- Then we entered the regular expression \s*,\s*. Short explanation: \s means a space character (whitespace, tab, endline and etc.), * means zero or more times. Then we pressed Alt-Enter which is Find All command.
- After that we pressed Delete and cursor left on the necessary positions.
- Then we pressed Enter and edited the lines using Ctrl-Left and Ctrl-Right for words navigation.
Trick 3: Find duplicates with Sublime Text
Finding duplicate lines in Sublime Text can be very useful because:
Data Cleanup: Firstly, when working with large datasets, logs, or lists, duplicates can cause errors or inaccuracies. Identifying them helps ensure clean, reliable data.
Code Quality: Secondly, duplicate lines in code might be a sign of redundancy or a copy-paste mistake. Finding them helps you refactor and keep your codebase clean and efficient.
Efficiency: Manually spotting duplicates in big files is time-consuming. Sublime Text can quickly highlight or remove them, saving you lots of time.
Error Prevention: In configuration files, repeated entries might cause unexpected behavior. Catching duplicates early can prevent bugs and crashes.
Version Control and Merging: After merging files or code branches, duplicates can sneak in. Quickly finding them helps maintain consistency.
In this example we are going to highlight equal strings.
Initial lines
188417
72
8512
251127
670
337970
524267
297450
8512
337970
Expected output
188417
251127
297450
337970
337970
524267
670
72
8512
8512

We have done the following actions:
- Ctrl-A – select all lines
- F9 – sort lines
- Ctrl-F – open find panel
- We entered the regular expression ^(.*)$\n^\1$
^ – the beggining on line
. – any symblol
* – zero
$ – end of line
\n – end of line symbol
\1 – the first product of regular expression - Then we pressed Alt-Enter which is Find All command and got all equal lines highlighted.
Summary
It is a good idea to practice by yourself and memorize the key Sublime Text combinations:
- Ctrl-A – select all lines.
- Shift-Ctrl-L – put multiline cursor in the selected lines.
More key can be found in this disscution: https://forum.sublimetext.com/t/my-sublime-text-windows-cheat-sheet/8411 With this key combinations you will be able to:
Convert Multiple Lines into One Line:
This operation helps you quickly merge several lines into a single continuous line. It’s useful for preparing data for APIs, compacting configurations, minimizing file size, or creating clean, shareable snippets.
Convert One Line into Multiple Lines:
Breaking a long line into several shorter lines improves readability, makes editing easier, and helps meet code style guidelines. It’s especially helpful when working with long lists, commands, or structured data.
Find Duplicate Lines:
Finding and handling duplicate lines is essential for cleaning datasets, improving code quality, preventing errors, and maintaining organized files after merges or imports.