Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extend Notepad++

Tags:

notepad++

As I use Notepad++ daily at work, I want to extend it to be more productive.

What i want to do is select multiple lines containing words, right click and click a menu item like "Comma separate" then get all words on a single line comma separated.

I know that Notepad++ has support for macros and plugins. What would be the best way to do this?

I've got limited C++ skills.

Update:

To clarify, it's never more than 5 or 6 lines of words i need to re-format. The problem is that I do this like 50 times a day, so a way to speed up this would be great. Is there any other application that can do this for me?

Update2

Thanks for your answers. I'm going to try creating a Notepad++ plugin.

Update3

Does anyone know of a .NET-wrapper to create a Notepad++ plugin? Maybe this should be a new question.

like image 433
alexn Avatar asked Jun 30 '09 08:06

alexn


2 Answers

I often use Notepad++'s macro function for things like this.

Eg. Say you have this:

apple
pear
banana
grape
orange

To comma separate lines, you could go to the first line, press ctrl+r (start recording), then end, delete, comma, then ctrl+r again to stop recording.

Then press control+p (play recording) repeatedly until you have what you want. If I'm processing a large file, I just hold it down, then ctrl+z my way back if I go too far.

You can't save your macro for later, but something that simple is easy to do again.

Edit: Actually, it turns out you can save your macro for later, and even assign a hotkey to it. Just record the macro, then go Macro -> Save current recorded macro.

like image 34
Blorgbeard Avatar answered Nov 25 '22 12:11

Blorgbeard


You can do this easily now with the Python Scripting plugin for Notepad++.

Just add a script with something like

text = editor.getSelText()
text = text.replace(' ', ',')
editor.replaceSel(text)

Assign the script a shortcut or toolbar button and you're away. I'm not totally clear on what you want to replace, but obviously changing the logic of the script should be pretty easy.

like image 191
Dave Brotherstone Avatar answered Nov 25 '22 11:11

Dave Brotherstone