Coding Tricks : Using Multi-Editing in Notepad++ to do your tasks faster

We pretty much type everyday, every working hour. Let it be Excel, Word, Powerpoint, Visual Studio, HTML, or simply your Email. We code, we write articles, we write mails, we write scripts and so much we do with text. And then you stumble across certain tasks that is repetitive, and you wish if you could automate it so it gets done in a click, don’t you ?

So, sometimes you just wish you could type things faster, or at many places together, or copy one code element at 10 different places in one go, or things of similar sort. You might want to replace with one letter at multiple places, or just add some text before and after your 200 line code. You might thing this is do-able in excel, but do-able is just not enough anymore. You need to move to multi-editing !

Rejoice, your favorite editors Notepad++ and Sublime has this feature already. Let’s see how to do that in Notepad++.

Go to Settings – Preferences – Editing – Enable ‘Multi-Editing Settings checkbox’

n1

Lets say you have your text like –
abc 123
def 456
ghi 789

And you need it like –
The cost of abc is 123
The cost of def is 456
The cost of ghi is 789

Of course this is breeze in excel but we don’t prefer that since –
-Excel can bring in garbage values that can cause error in codes
-Creating that formula is tricky when you have characters like +=- etc

So how we do it in Notepad++ ? Lets see –

Once you have enabled multi-editing using above steps, simply place your cursor before abc in the first line, then hold Ctrl and click before ‘def’, and while you are holding Ctrl, click before ‘ghi’ also. You will see a cursor is blinking in front of each row.

n2

Now, start typing. You will see that you are automatically typing at 3 places in one time.

n3

Done. You have just achieved it in 5 seconds that would take a minute in Excel !

n4

Also, Explore the Record Macro functionality that lets you do multiple things on a row and then repeat it over other lines in one click.
Here is how ->

  • Place your cursor at the start of your text, click the ‘record’ button in the ribbon, and then edit just that one row of text. You may only use arrow keys or ctrl+arrow keys to move around characters/words rather than clicking with your mouse. The ‘home’ and ‘end’ keys are also useful.
  • When you’re finished with that one line, move your cursor (again without using the mouse) to the start of the next line.
  • Click the ‘stop recording’ button.
  • Click the ‘play macro’ button to check that it works on the next line as expected.
  • Click the ‘run macro multiple times’ to do it for all the lines of the code, and you would see the magic happening in seconds !

Watch this video tutorial to see how to do it. If you like the post and found it quite useful in your daily work, don’t forget to send me a comment.

Hope you enjoyed the video and the blog. Until next time, keep coding !

3 Comments

  1. I needed to thank you for this great read!! I
    definitely loved every little bit of it. I’ve got you bookmarked
    to check out new stuff you Hey there! Someone in my Myspace
    group shared this site with us so I came to take a
    look. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers!
    Excellent blog and superb design and style. I enjoy what
    you guys are up too. This kind of clever work and exposure!
    Keep up the fantastic works guys I’ve included you guys
    to my own blogroll. http://foxnews.org

  2. Excellent article. Keep posting such kind of info on your page.
    Im really impressed by your site.
    Hey there, You have done a fantastic job. I will certainly digg it and personally suggest
    to my friends. I am sure they will be benefited from this website.

Leave a Reply

Your email address will not be published.