sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    [Info] Notepad++ : Tip, Tricks & Plugins

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 3 Posters 6.7k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by Dan Rathbun


      Notepad++ : Tip, Tricks & Plugins


      This thread is for noting new plugins, updates, Tips & Tricks, etc.


      Suggest New Features for Notepad++
      (link to sourceforge.net IdeaTorrent)

      Notepad++ Command Line switches


      Config Files to Enhance Notepad++ :

      • Syntax Highlighting

      • Updated Ruby keywords for " %(#BF4000)[langs.xml]"

      • Copy and Paste the keywords block, into the %(#8000BF)[<Keywords name="instre1">] tag, of the %(#8000BF)[<Language name="ruby" ...>] tag, of your " %(#BF4000)[langs.xml]" file, in your " %(#BF4000)[#{ENV['APPDATA']}/Notepad++]" directory.* ruby_keywords_lang_xml.txt* You must restart Notepad++, for the new keyword highlighting, to take effect.* See post "Trick: Ruby Keywords update for langs.xml" for more information.


      Tips & Tricks :

      • Encoding

      • Saving Ruby source as UTF-8

      • Workflow

      • Customizing your popup Context Menu.* Converting tabs to spaces before posting code online

      • Dragging Files between Notepad++ Instances


      Plugins :

      • Workflow

      • Session Manager Plugin


      Other posts on the use of Notepad++ :

      • API Auto-Complete

      • Notepad++ SU8 Ruby API Autocomplete* Notepad++ users: heads up (old)

      • Notepad++ and SketchUp Bridge in SU8

      • [Code] bridge_ext.rb

      • Notepad++ Collaboration

      • Syntax Highlighting

      • Notepad++ Ruby Syntax enhancement

      • Upgrade NotePad++?

      • Alternate Editors:

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180&t=18584:3udq66g5]Notepad++ equivalent for Mac?[/url:3udq66g5]

      • [url=http://forums.sketchucation.com/viewtopic.php?f=180&t=9809:3udq66g5]Notepad 2 with Ruby[/url:3udq66g5]


      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        I recently found out, by accident, that Notepad++, can open new instances "on the fly."

        If the app window is smaller than the screen, and you grab one particular filetab, and drag it out of the app and drop it on the desktop, it opens a new Notepad++ instance, with only that file open.

        And if you drag a file from an instance that only has that file open, into another Notepad++ instance, then the instance with no open file closes automatically.

        There also is a command line parameter (-multiInst) to start a new instance of NPP.
        see: Notepad++ Command Line switches

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          I find this plugin very useful. You can totally switch projects using this plugin. And you can use a custom Session file directory (or change the dir from time to time.)

          Drawback: No "browse" folder for the session directory. You will need to cut & paste a path from FileExplorer. (Note! put a "****" at the end of the path, or error popups will result.)

          SessionMgr
          http://mfoster.com/npp/SessionMgr.html

          You need to manually create the folders in the %APPDATA% path, or you will get "unable to find path specified" error popups, when NPP launches, or when trying to save plugin SessionMgr settings.

          Also the VSC2010 runtime is needed. (The author, Mike Foster, has a link to the Microsoft download for this on his plugin download page.)

          The help forum topic for this plugin:
          sourceforge.net/projects/notepad-plus/forum/topic/New plugin: SessionMgr

          Vote here, to have this plugin integrated into the Notepad++ Core, and appear on the "File" menu.


          Addendum (2011-09-09): The Session Manager plugin now appears in the NPP Plugin Manager (thanks to Dave Brotherstone.)

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            Some forums do not handle tabs very well when posting code. You can convert tabs to spaces, in a copy of your code (a temporary new document window that you abandon without saving.) Then when you post the code, readers will be able to read your code blocks much easier.


            To replace tabs with spaces, in a COPY of your code:
            (If you do not want to actually change your files (that you work with.)

            "Edit" (menu) > "Select All" or CTRL+A
            "Edit" (menu) > "Copy" or CTRL+C
            Click the "New" file button, and paste in the code.
            Then click the find button (Binoculars)
            On the "Find" dialog, switch to the "Replace" (page)
            In the "Find what:" box type: \t
            ("\t" is the escape chars for a TAB.)
            In the "Replace with:" box type spaces (2 or 4, whatever you wish.)
            In the "Search Mode" group at the lower-left, select "Extended {...}", or press ALT+X

            Then click the "Replace All" button.

            If everything worked OK... close the Find/Replace dialog.
            Select All text again (if you need to.)
            "Edit" (menu) > "Copy" or CTRL+C
            (so the text with spaces instead of tabs is on clipboard,)
            Then switch to your browser, where you should already have your SketchUcation "POST A REPLY" form ready,
            click between [ code ] [ /code ] tags (or click the [ Code ] button on the edit post toolbar, which will paste in the tags, and put the cursor between them, for you.)
            CTRL+V (to paste in the code's text.)

            When you go back Notepad++, you just close the "New" tab, and say "No" to save.


            ADD: I DO think that Notepad++ can run macros. So you might check the NPP docs, on how to write a "replace all tabs with 4 spaces" macro.



            To replace tabs with spaces, as you type code:
            (Your files will not have tab characters in them at all.)

            In Notepad++,
            "Settings" (menu) > "Preferences" (dialog) > "Language Manu/Tab Settings" (page)
            In the "Tab Settings" group (on the right of the page,)

            .. if you hilight "ruby" in the list:
            and check "replace by space"

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Saving Ruby source as UTF-8 character encoding,
              so it can be parsed by the Ruby Interpreter.

              Note the value of $KCODE must be set to UTF8.

              • Sketchup does this for you, when it loads the Ruby Interpreter DLL.
              • If you are running outside of Sketchup, you will need to run Ruby with a -K commandline option. (Options: e,s,u,a or n.)

              Using Notepad++, you must save the source file in "UTF-8 without BOM" Encoding (aka "ANSI as UTF8", will show up in the status bar on the lower right.)

              With the file open, "Encoding" (menu) > "Encode in UTF-8 without BOM"
              .. and also end of line setting:
              "Edit" (menu) > "EOL Conversion" (submenu) > "UNIX Format"
              (Current EOL setting shows on status bar, lower right, just left of the current encoding setting.)

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                Doesn't SU plugins fail if they are saved as UTF-8? Thought I had tried that at some point...

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  Did you try loading the sample here:
                  Re: Program format ??

                  It did fail when I saved it as just "Encode in UTF8", (.. the interpreter did not get past the first "#" char on line 1.)

                  No problems with "ANSI as UTF-8" encoding.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    Capture.PNGSeems to work fine on PC...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      hm.. will have to try it again. Would be good to use UTF-8.

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by

                        @thomthom said:

                        hm.. will have to try it again. Would be good to use UTF-8.

                        Can you say "literal local language lookup hashes", boys and girls?

                        I'm not here much anymore.

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by

                          Added an updated keywords list for the user (APPDATA) " %(#BF4000)[langs.xml]" file.

                          (See first post, "Config Files" section, for the keywords list file. Make a backup of your old file before editing it.)

                          Why did I need to change the keywords list ?

                          • It was missing some keywords from the 1.8.x trunk, and the few additional ones from the 1.9.x trunk.

                          • Also, it did not contain certain Interpreter defined aliases and constants, that are mandatory (no option on our part, they are always defined.)

                          As such, these constants and aliases, are in effect, keyword extensions.

                          For those who argue that constants are not keywords, I submit that these particular constants, must be treated as keywords, and highlighted in a way that informs coders that they are special, and not to be overridden or redefined (unless you are a very experienced rubyist, and absolutely know what the "bleep" you are doing.) Changing these constants, can break all other Ruby scripts running. So this is why they are now on the list.

                          Here's the list, if you just wish to copy and paste it (without downloading,) or for discussion purposes:

                          ARGF ARGV BEGIN END ENV FALSE DATA NIL RUBY_PATCHLEVEL RUBY_PLATFORM RUBY_RELEASE_DATE RUBY_VERSION PLATFORM RELEASE_DATE STDERR STDIN STDOUT TOPLEVEL_BINDING TRUE __ENCODING__ __END__ __FILE__ __LINE__ alias and begin break case class def defined? do else elsif end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield
                          

                          EDIT: Just a note.. to say why the standard VERSION constant is not, on the list. This constant should always be defined as a local constant within namespaces (module and class definitions.) This is also likely why the global constant for Ruby's version, was renamed to RUBY_VERSION.

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • Dan RathbunD Offline
                            Dan Rathbun
                            last edited by


                            I found a easier way to add custom keywords to a programming language, than manually editing the "langs.xml" file(s).


                            In the "Settings" (menu) > "Style Configurator" (dialog),
                            Highlight the "Ruby" Language, and "INSTRUCTION" Style,
                            and add the extra keywords into the "User-defined keywords" textbox (space separated.):
                            NPP_Add_Keywords.png

                            I'm not here much anymore.

                            1 Reply Last reply Reply Quote 0
                            • Dan RathbunD Offline
                              Dan Rathbun
                              last edited by

                              Getting your Compare panes to lineup.

                              Recently I have been passing scripts back and forth with another developer. I make a change, send him the update. He make some changes, then sends me the file. .. and so on.

                              So I find myself using the "Compare" plugin to see what the changes were between the old version, and the new version.

                              The problem is that the Notepad++ distribution has an oversight in the "config.xml" file, that confuses the Compare plugin.
                              If you have the "ScintillaViewsSplitter" set to "vertical", the attributes for the "ScintillaPrimaryView" and "ScintillaSecondaryView" are not the same. Specifically the "zoom" attribute is set to be 1 point smaller in the primary view pane. (Why? I have no idea.. seems stupid to me!)

                              Anyway.. when the font sizes are different in the two view panes, the Compare plugin cannot sync the text lines in the panes, and this also screws up the mutual scrolling feature. (You see really weird scroll bar behavior, especially when you are near the bottom of one of the files.)

                              The answer is to manually edit the user "config.xml" file, in the "%APPDATA%/Notepad++" directory.

                              INSERT (2015-05-22): An easier way than manually editing the xml file, may be to put the cursor on the pane with the larger font, and then hold the CTRL key on the keyboard down, while rolling the mouse wheel "down" toward you ONE click. (You can do the opposite also, make the smaller font pane one click larger.) Then close and reopen NPP. The settings should be saved. (It is likely this is how the settings got unsync'd in the first place.)

                              BUT .. you cannot edit it with Notepad++ itself, because the changes will be overwritten when you close NPP.

                              You need to use another editor, such as MS Visual Studio, or MS XML Notepad, etc., to make the changes.

                              In the "ScintillaPrimaryView" tag, I changed the "zoom" attribute to be "0" (because, I want my style font size settings to apply as I have them set.)
                              Then I copied all that tags attributes, into the "ScintillaSecondaryView" tag, so as to be sure that all the attributes are EXACTLY the same.
                              Saved the file (I used MSVS, BTW,) and started Notepad++, and opened an absolete ruby file, and a newer one, side-by-side, with the view panes split vertically. Launched a Compare from the Plugins menu.. and all is well now. (The lines in both panes line up, and no more weird scroll bar behavior.)

                              πŸ˜„

                              I'm not here much anymore.

                              1 Reply Last reply Reply Quote 0
                              • Dan RathbunD Offline
                                Dan Rathbun
                                last edited by

                                It's quite easy to customize your Right-Click Popup ContextMenu in Notepad++

                                For this example, we use the SessionManager Plugin by Mike Foster. (The plugin is now up to version 0.6 and works very well now. So update if you have an older version.)

                                I have many project sessions saved, and now start Notepad++ with an empty session, and choose which project I will work on. There are two issues.
                                (1) The "Plugins" menu is huge! And having to go through it to get to the "Session Manager" sub-menu, each time, is a bummer.
                                (2) Even though the "Shortcut Mapper" is powerful, there is no way (that I can find,) to list those that have already been assigned. And a multitude have been! I do not know whether I will interfere with a shortcut that is already in use.

                                So instead, I added a ContextMenu sub-menu:

                                On the main menu: Settings > Edit Popup ContextMenu
                                (Click the OK button to have NPP open your user contextMenu.xml file.)

                                After the file opens, scroll down to the section beginning:

                                <!--
                                   To add plugin commands, .....
                                -->
                                

                                ... Add just below that comment (and above the lines adding "base64 encode" commands,) the following lines (if your running English and the actual "Session Manager" menu items are in English.):

                                
                                 <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Sessions..." />
                                 <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Settings..." />
                                 <Item FolderName="Session &Manager" id="0"/>
                                 <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Save current" />
                                

                                Now.. restart NPP, and you will now have a "Session Manager" submenu on the right-click popup context menu.

                                So launch a session:
                                Right-Click, M, ENTER


                                BUT.. say you do not like the author's menu item names (there are 3 that begin with "S" and Windows' built-in 'starting letter' menu accelerators will not work for items, that are on a menu where other items also begin with the same letter.)

                                No problem ... the contextMenu.xml format allows you to use a different name (and accelerator letter,) than the plugin author used in his "Plugins" sub-menu. Add an ItemNameAs= attribute, to the Item tag.

                                Say that you want the accelerator to be "S" for the "Session Manager" popup sub-menu, and rename the menu items, and specify what accelerator will fire them using &: (I also went up near the top of the file, and changed the accelerator for "Select All" to "A".)

                                 <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Sessions..." ItemNameAs="&Control..."/>
                                 <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Settings..." ItemNameAs="&Options..."/>
                                 <Item FolderName="&Session Manager" id="0"/>
                                 <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Save current" ItemNameAs="&Save Current Session"/>
                                 <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="Help" ItemNameAs="&Help"/>
                                 <Item FolderName="&Session Manager" PluginEntryName="Session Manager" PluginCommandItemName="About..." ItemNameAs="&About..."/>
                                
                                

                                [whoops... fixed the typos, so all the & in the same place.]

                                So I open Notepad++, Right-Click, and press "S" then "C", and choose which of my sessions I will work on.

                                And, on my machine, the context menu now looks like this:
                                npp_popup_session_mgr_submenu.png


                                A last word: The attribute PluginEntryName must be the plugin sub-menu title, as it appears in your localized langauge. The same for the PluginCommandItemName, it must be the sub-menu item you wish to clone, exactly as it appears on the main Plugins > whateverPlugin sub-menu.

                                I'm not here much anymore.

                                1 Reply Last reply Reply Quote 0
                                • 1 / 1
                                • First post
                                  Last post
                                Buy SketchPlus
                                Buy SUbD
                                Buy WrapR
                                Buy eBook
                                Buy Modelur
                                Buy Vertex Tools
                                Buy SketchCuisine
                                Buy FormFonts

                                Advertisement