Friday, September 2, 2011

Notepad++ Customize context Menu with TextFX

First off, I have used a bunch of different editors in my day, and have finally settled on Notepad++ ... the main reasons are:

  • It's Free
  • It has a fairly small footprint when it runs
  • It can be portable
  • It's customizable up the yin yang

This last point brings me to why I'm posting. You can add new items to the context menu which is a huge plus. The one I needed, however, was sort. I commonly will have a few lines of text that I'll need to sort

I'll have this:
Cat
Ball
Zebra
Molybdenum

I'll want this:
Ball
Cat
Molybdenum
Zebra

There is a really cool plugin called TextFX that has a command "Sort lines case insensitive (at column)". So, I figured I'd chuck that into the context menu.

Turns out, that integrating TextFX is not trivial. In fact, it's cryptic beyond belief. I think I finally figured out how to do it. I found a reference for the Notepad++ command names and used this in conjunction with another post regarding integrating TextFX into the context menu to figure out how to do all of this.

First off, TextFX is not integrated in the proper way with Notepad++. So, I had to do some playing.

In the aforementioned blog post the OP was trying to integrate the Rewrap Text command into the context menu. They were able to achieve this by using the PluginEntryName of "TextFX Characters". That's all well and good, but the Rewrap command is actually under the TextFX Edit menu. What I think is happening is that Notepad++ is seeing the TextFX Characters menu first and using that as the PluginEntryName. So, back to my issue, I found the corresponding command name for sorting on the command name reference page (T:Sort lines case insensitive (at column)) popped it in... reload N++ ... and ... poof... sort in the context menu.

For those of you that just want the code, here it is: <Item PluginEntryName="TextFX Characters" PluginCommandItemName="T:Sort lines case insensitive (at column)" ItemNameAs="Sort Lines" />

Happy Notepad++ing

6 comments:

  1. Thanks for this. Just what I was looking for.

    ReplyDelete
  2. Thanks for that! Improved my speed up to 20% ;)
    Just love Notepad++

    ReplyDelete
  3. Thank you so much! I couldn't figure out why PluginEntryName="TextFX Tools" wasn't working.

    ReplyDelete
  4. Thank you! A real time saver.

    ReplyDelete
  5. This worked perfectly. Thanks.

    ReplyDelete
  6. Yes, thank you. It was all about the 'T:'

    ReplyDelete