How to use Calcpad with Notepad++

Notepad++ is one of the most popular and free text/code editors. It supports many different programming and scripting languages. You can also edit HTML, XML, CSS, JSON and other types of files. Currently, its text editing capabilities significantly exceeds those of the Calcpad own editor. Some features that worth mentioning are:

  • multiple file tabs;
  • predefined and custom styles;
  • advanced search/replace capabilities;
  • column editor;
  • auto completion;
  • bracket matching;
  • line operations/sorting;
  • tab/white space management;
  • content folding, etc.

And and last but not least – syntax highlighting. Unfortunately, the Calcpad language is not natively supported by Notepad++. However, there is an option to add a custom language with user defined syntax (UDL). Then, you can export it as an xml file and import it everywhere else.

The good news is that we have already created the required language definition files, so you can use them to write Calcpad programs with Notepad++.

To use Notepad++ as Calcpad code editor you need to the following:

  1. Download and install Notepad++ from the following link:
    https://notepad-plus-plus.org
  2. Download the Calcpad language definition files:
    https://calcpad.eu/download/Notepadpp.zip
  3. Unzip the archive in the preferred folder. You will find two files inside:
    – Notepad++.xml – for light mode and
    – Notepad++dark.xml – for dark mode.
  4. Start Notepad++. Click the “Language” menu, then “User defined language” and “Define your language…”
  5. Click the “Import…” button in the dialog that will appear.
  6. Browse for the one of the xml files above and click “Open“.

From now on, each time you open a .cpd file, it will be automatically displayed with the Calcpad syntax highlighting. For best results with the dark theme, select the appropriate style from the “Style Configurator” dialog.

You can find it in the “Settings” menu. For example, a good option is the Twillight theme. You can also set a nice monotype font, such as “Noto Mono“, “Liberation Mono“, “Source Code Pro“, “Consolas“. etc. You can also make the whole interface t dark, by checking “Enable dark mode” in the “Preferences” dialog from the same menu.

You can also make possible to run the Calcpad programs directly from inside the Notepad++ editor. For that purpose, you will have to install the Franco Stellari’s RunMe plugin for Notepad++. You can find detailed instructions in this file: install.txt. It will add a small button at the end of the Notepad++ toolbar . Click the button or press Shift+F5 to run the current program.

.

Published by Calcpad

Hi, my name is Ned. I am a structural engineer with over 20 years of experience in the design of nuclear and industrial facilities, factories, residential and public buildings. I am a fan of engineering, mathematics and computer programming. I spend a lot of time for developing of useful tools that help structural design.

2 thoughts on “How to use Calcpad with Notepad++

  1. Thanks for highlighting file!
    But opening file in new instance of Calcpad by Shfit+F5 is not enough 😦
    How to reload file within Calcpad from Notepad++ without restarting by one button:

    How to reload file within Calcpad without restarting

    Notepad++

    1. Install https://github.com/guilryder/clavier-plus
    2. Create file:
      C:\my-cli\npp-run-calcpad.bat:
    "%SystemRoot%\System32\chcp.com" 65001 > nul
    "%SystemRoot%\System32\tasklist.exe" | "%SystemRoot%\System32\find.exe" "Calcpad.exe" || ("%programfiles%\Clavier\Clavier.exe /sendkeys  "[{Focus,10,*Notepad++}][Ctrl+S]" & timeout 1 & start "" "%programfiles%\Calcpad\Calcpad.exe" "%~1" & exit)
    "%programfiles%\Clavier\Clavier.exe" /sendkeys "[{Focus,10,*Notepad++}][Ctrl+S][{Copy,%~1}][{Wait,10}][{Focus,10,Calcpad 5.*}][{Wait,10}][Alt][{Wait,10}][Down][{Wait,10}][Enter][{Wait,10}][Right][{Wait,10}][Enter][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+O][{Wait,10}][Ctrl+V][{Wait,10}][Enter][{Wait,200}][{Focus,200,*Notepad++}]"
    1. Change shortcuts.xml inside Notepad++ folder:
    <?xml version="1.0" encoding="UTF-8" ?>
    <NotepadPlus>
        <InternalCommands />
        <Macros>
            <Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
                <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
                <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
            </Macro>
        </Macros>
        <UserDefinedCommands>
            <Command name="Get PHP help" Ctrl="no" Alt="yes" Shift="no" Key="112">https://www.php.net/$(CURRENT_WORD)</Command>
            <Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command>
            <Command name="Open selected file path in new instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command>
            <Command name="CalcPad" Ctrl="no" Alt="no" Shift="no" Key="120">C:\my-cli\npp-run-calcpad.bat &quot;$(FULL_CURRENT_PATH)&quot;</Command>
        </UserDefinedCommands>
        <PluginCommands />
        <ScintillaKeys>
            <ScintKey ScintID="2469" menuCmdID="42010" Ctrl="yes" Alt="no" Shift="yes" Key="68" />
        </ScintillaKeys>
    </NotepadPlus>
    1. NOTE!!! It runs by F9 now (Key="120") – you can change it from menu Run -> Modify Shortcut/Delete command
    2. Remove RunMe plugin from Notepad++ if you don’t use it for other cases.

    CudaText

    1. Install https://github.com/guilryder/clavier-plus
    2. Create file:
      C:\my-cli\cudatext-run-calcpad.bat:
    "%SystemRoot%\System32\chcp.com" 65001 > nul
    "%SystemRoot%\System32\tasklist.exe" | "%SystemRoot%\System32\find.exe" "Calcpad.exe" || (start "" "%programfiles%\Calcpad\Calcpad.exe" "%~1" & exit)
    "%programfiles%\Clavier\Clavier.exe" /sendkeys "[{Copy,%~1}][{Wait,10}][{Focus,10,Calcpad 5.*}][{Wait,10}][Alt][{Wait,10}][Down][{Wait,10}][Enter][{Wait,10}][Right][{Wait,10}][Enter][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+Z][{Wait,10}][Ctrl+O][{Wait,10}][Ctrl+V][{Wait,10}][Enter][{Wait,200}][{Focus,200,*Notepad++}]"
    1. Install plugin “External Tools”
    2. Add tool with Tools -> Config… -> Add…:
    • Name: cudatext-run-calcpad.bat
    • File name: C:\my-cli\cudatext-run-calcpad.bat
    • Parameters: {FileName}
    • Initial folder: {FileDir}
    • Lexers: Calcpad
    • Save before: Current document
    • Hotkey: F9
    • Capture output: Ignore

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: