Sublime is one of the most used code editor by the developers. It is famous because of its packages & other great features. It keeps up working to make it better.
I cam across the condition where I had thousands of line and had to put certain text at the start & end of the each line. I decided to research instead doing manual, luckily this resolves the issue.
We must enable Regular expressions for this. Please follow the following steps to do so.
- Ctrl + H for the search & replace option
- Select in the code section, Ctrl+A for selecting all
- Press Ctrl+Shift+L lets you to select at the end of the cursor for all the selections
- Enable regular expression in search & replace section
- After this follow below steps for the inserting in the start & end
Insert in the start of each line
- Replace ^ with your text. For example: if you are adding ” in each line start, place ^ in find & keep ” in the replace.
- Then Press replace all. BOOM! you will be happy.
Insert in the end of each line
- Replace $ with the text or anything you will like to put at the end of each line.
- Keep $ in find & your text (eg: * ) in the replace field. Then press, replace all. You will surprised that you will reduce your manual work pretty much.