notepad++ Useful plugins for developers NppExec


Example

NppExec [sourceforge] allows you to execute commands and scripts from a console window in Notepad++. It can be found in the menu bar at Plugins -> NppExec or just by simply hitting the F6 key (the shortcut Ctrl+F6 will run the latest command) .

Example: the following will

  • Set the console to output_var: on, meaning we can use the output of the console
  • run a SQL query from the file C:\scripts\query.sql
  • take the output from the console and put it into the active file at the cursor
  • close the console
  • clear the console
NPE_CONSOLE v+
sqlcmd -S 111.111.1.1 -U UserName -P "password" -i C:\scripts\query.sql
sel_settext $(OUTPUT)
NPP_CONSOLE 0
cls

NppExec also allows you to save your scripts. After saving them, you can go to Plugins -> NppExec -> Advanced Options and run it anytime Notepad++ starts, closes, or even add that script to the Plugin commands using Macros. For example, by saving the above example as a "Run Query", I could use the bottom left fields in the Advanced Options to add it to the menu.

The script will be available as a macro after a restart of Notepad++ as long as the "Place to the Macros submenu" box is checked.

Finally, a shortcut can be assigned to the macro/command by using Settings -> Shortcut mapper -> Plugin commands.
{"cc_re__cc_re__cc_by_sa_3_0": ["\"additionalType\": \"HowTo\",\r\n    \"name\": \"notepad++\",\r\n    \"description\": \"NppExec\"\r\n    }\r\n</script>\r\n\r\n</div>\r\n\r\n<div class=\"site-footer\">\r\n        <div class=\"site-footer-copyright\">\r\n            <div class=\"container\">\r\n                \r\n<div>This modified text is an extract of the original <a href=\"https://archive.org/details/documentation-dump.7z\" target=\"_blank\">Stack Overflow Documentation</a> created by following <a href=\"/contributor?exampleId=12662\">contributors</a> and released under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" target=\"_blank\" rel=\"nofollow\">CC BY-SA 3.0</a></div>\r\n<div>This website is not affiliated with <a href=\"https://stackoverflow.com/questions/tagged/notepad++\" target=\"_blank\">Stack Overflow</a></div>\r\n\r\n            </div>\r\n        </div>\r\n\r\n    <div class=\"site-footer-link\">\r\n        <div class=\"container\">\r\n            <div class=\"row\">\r\n                <div class=\"col-lg-1\">\r\n                    <br/>\r\n                    <img src=\"/Images/logo_rip_full_white.png\" alt=\"logo rip\" height=\"64\" width=\"64\">\r\n                </di"], "copyright__copyright__copyright": ["Options and run it anytime Notepad++ starts, closes, or even add that script to the Plugin commands using Macros. For example, by saving the above example as a \"Run Query\", I could use the bottom left fields in the Advanced Options to add it to the menu.\n\nThe script will be available as a macro after a restart of Notepad++ as long as the \"Place to the Macros submenu\" box is checked.\n\nFinally, a shortcut can be assigned to the macro/command by using Settings -> Shortcut mapper -> Plugin commands."]}