diff --git a/_posts/2018-09-10-notepadplusplus-integration.md b/_posts/2018-09-10-notepadplusplus-integration.md new file mode 100644 index 0000000..1059028 --- /dev/null +++ b/_posts/2018-09-10-notepadplusplus-integration.md @@ -0,0 +1,9 @@ +--- +layout: post +title: "Notepad++ Integration" +date: 2018-09-10 22:00:00 +0200 +comments: false +--- + +We put together some [step-by-step instructions]({{ site.baseurl }}/docs/install.html#notepadplusplus) on how to call +*boxes* directly from the Notepad++ editor on Windows. It requires a bit of clicking to set up, but works like a charm! diff --git a/css/boxes.css b/css/boxes.css index b7737a9..7daf542 100644 --- a/css/boxes.css +++ b/css/boxes.css @@ -118,3 +118,8 @@ div.bxEmbedContainer { -webkit-box-shadow: 1px 1px 4px rgba(34, 34, 34, 0.6); box-shadow: 1px 1px 4px rgba(34, 34, 34, 0.6); } + +.mark-hilite { + background-color: #e0ffe0; + border-radius: 3px; +} diff --git a/docs/install.html b/docs/install.html index ef08595..e7a245b 100644 --- a/docs/install.html +++ b/docs/install.html @@ -171,3 +171,78 @@ your config file. the selected text. In may be accessed via the command palette like above, or you might want to define a hotkey or a macro to do it. 1. Add more FilterPipes commands for other designs, or for removing and repairing your ASCII art boxes. + +  + + +## 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* +1. If NppExec is not on the *Installed* tab already, go to the *Available* tab and select NppExec from the list. +1. Press **Install**. +1. Restart Notepad++ + + ![Plugin Manager]({{ site.baseurl }}/images/editor-npp-pluginmanager.png) + +Once the NppExec plugin is available, proceed with *boxes* integration: + +1. Go to *Plugins → NppExec → Execute ...* +1. 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
+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](https://notepad-plus-plus.org/community/topic/16158/2) 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`. +1. Press **Save** on the *Script name* input box. + + ![NppExec Script]({{ site.baseurl }}/images/editor-npp-script.png) + +1. Go to *Plugins → NppExec → Advanced Options ...* +1. 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*. +1. Optionally select *Place to the Macros submenu*, if you want an entry for this in the *Macros* menu. +1. Press **OK**, and if asked, restart Notepad++. + + ![NppExec Advanced Options]({{ site.baseurl }}/images/editor-npp-options.png) + +1. Go to *Macro → Modify Shortcut/Delete Macro...* to call up the Shortcut mapper. +1. Select the *Plugin commands* tab, and type `boxes` into the filter line at the bottom of the dialog window. +1. Choose our `boxes nuke 80` entry and press **Modify**: + + ![Shortcut mapper]({{ site.baseurl }}/images/editor-npp-shortcut.png) + +1. Assign a shortcut key, for example Ctrl+Shift+B. +1. 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! | + |______________________________________________________________________________| diff --git a/images/editor-npp-options.png b/images/editor-npp-options.png new file mode 100644 index 0000000..86a8aba Binary files /dev/null and b/images/editor-npp-options.png differ diff --git a/images/editor-npp-pluginmanager.png b/images/editor-npp-pluginmanager.png new file mode 100644 index 0000000..dd27ea0 Binary files /dev/null and b/images/editor-npp-pluginmanager.png differ diff --git a/images/editor-npp-script.png b/images/editor-npp-script.png new file mode 100644 index 0000000..2af52b4 Binary files /dev/null and b/images/editor-npp-script.png differ diff --git a/images/editor-npp-shortcut.png b/images/editor-npp-shortcut.png new file mode 100644 index 0000000..bb1a1a9 Binary files /dev/null and b/images/editor-npp-shortcut.png differ