boxes/pages/editors-notepadplusplus.md
Thomas Jensen c049484e4c
Update website design
- Updated frameworks for better browser support
- Improved responsive design
- Versioned documentation
- Better social media support via the Jekyll SEO plugin
- New looks, fwiw
- Start page has some more relevant info
- Documentation sorted to be more easily accessible
- Internally upgraded from plain CSS to SASS
2021-05-26 21:13:21 +02:00

4.5 KiB

title permalink created_at last_modified_at
Editor Integration - Notepad++ editors-notepadplusplus.html 2018-09-15 21:57:00 +0200 2021-05-04 22:00:00 +0200

Back to All Editors

Integration with Notepad++

In order to integrate boxes with Notepad++, first make sure that boxes is on your PATH. On Windows, this usually means boxes.exe and boxes.cfg must be located in a directory which is on the PATH environment variable. This method of boxes integration works only on Windows, because afaik, Notepad++ is available only on Windows.

We use the NppExec plugin. Install NppExec via PluginManager:

  1. Display PluginManager via the main menu: Plugin → Plugin Manager → Show Plugin Manager

  2. If NppExec is not on the Installed tab already, go to the Available tab and select NppExec from the list.

  3. Press Install.

  4. Restart Notepad++

    Plugin Manager

Once the NppExec plugin is available, proceed with boxes integration:

  1. Go to Plugins → NppExec → Execute ...

  2. Paste the following script into the text area:

    NPP_CONSOLE 0  
    

cls cmd.exe /c exit %RANDOM% set tempfile = $(SYS.TEMP)\NppBoxes_$(EXITCODE).out.txt set ascfile = $(SYS.TEMP)\NppBoxes_$(EXITCODE).in.txt sel_saveto $(ascfile) :a cmd.exe /c boxes -d nuke -s 80 -pt1 -ac "$(ascfile)" > "$(tempfile)" sel_loadfrom $(tempfile) cmd.exe /c del /f /q "$(tempfile)" "$(ascfile)"

This script is inspired by a post by Peter Jones on the Notepad++ forum. It works via temp files in ANSI format. (That's the :a argument to the sel_saveto command.) This is compatible with boxes, and also helps avoiding byte order marks at the beginning of the temp file.
The green part marks the place where you configure the box. In this case, we'll get a nuke box 80 characters wide, with the text centered in it and an extra blank line at the top.

  1. Press Save... and give it a meaningful name, for example boxes nuke 80.

  2. Press Save on the Script name input box.

    NppExec Script

  3. Go to Plugins → NppExec → Advanced Options ...

  4. In the Associated Script dropdown, select the boxes nuke 80 script entry created previously, then press Add/Modify to add it to the list of Menu items.

  5. Optionally select Place to the Macros submenu, if you want an entry for this in the Macros menu.

  6. Press OK, and if asked, restart Notepad++.

    NppExec Advanced Options

  7. Go to Macro → Modify Shortcut/Delete Macro... to call up the Shortcut mapper.

  8. Select the Plugin commands tab, and type boxes into the filter line at the bottom of the dialog window.

  9. Choose our boxes nuke 80 entry and press Modify:

    Shortcut mapper

  10. Assign a shortcut key, for example Ctrl+Shift+B.

  11. Make sure that the Shortcut mapper reports No shortcut conflicts for this item in the status area.

That's it, finally! Now you can select any piece of text in the Notepad++ editor and draw the nuke 80 box around it by pressing your assigned shortcut:

                                  _ ._  _ , _ ._
                                (_ ' ( `  )_  .__)
                              ( (  (    )   `)  ) _)
                             (__ (_   (_ . _) _) ,__)
                                 `~~`\ ' . /`~~`
                                 ,::: ;   ; :::,
                                ':::::::::::::::'
 ___________________________jgs______/_ __ \___________________________________
|                                                                              |
|                                LOOK AT THAT!                                 |
|______________________________________________________________________________|