SketchUcation Plugin Store

 

 

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

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

Postby Dan Rathbun » Tue Aug 30, 2011 9:47 pm



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 "langs.xml"
      • Copy and Paste the keywords block, into the <Keywords name="instre1"> tag, of the <Language name="ruby" ...> tag, of your "langs.xml" file, in your "#{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 :



Plugins :



Other posts on the use of Notepad++ :
Please, register (free) to access all the attachments on the forums.
Last edited by Dan Rathbun on Sat Jun 16, 2012 8:28 pm, edited 6 times in total.
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4097
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Session Manager Plugin

Postby Dan Rathbun » Tue Aug 30, 2011 9:57 pm

    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.)
    Last edited by Dan Rathbun on Fri Sep 16, 2011 2:49 am, edited 2 times in total.
    User avatar
    Dan Rathbun
    Top SketchUcator
     
    Posts: 4097
    Joined: Tue Oct 06, 2009 3:06 am
    Location: Florida, USA
    Name: Dan Rathbun
    Operating system: Windows
    SketchUp version: 2013
    License type: Pro
    SketchUp use: education
    Level of SketchUp: Advanced

    Notepad++ Trick : dragging files between instances.

    Postby Dan Rathbun » Fri Sep 09, 2011 9:03 am

    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
    User avatar
    Dan Rathbun
    Top SketchUcator
     
    Posts: 4097
    Joined: Tue Oct 06, 2009 3:06 am
    Location: Florida, USA
    Name: Dan Rathbun
    Operating system: Windows
    SketchUp version: 2013
    License type: Pro
    SketchUp use: education
    Level of SketchUp: Advanced

    Notepad++ Trick : Converting tabs to spaces before posting

    Postby Dan Rathbun » Sun Feb 12, 2012 11:57 am

      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"
      User avatar
      Dan Rathbun
      Top SketchUcator
       
      Posts: 4097
      Joined: Tue Oct 06, 2009 3:06 am
      Location: Florida, USA
      Name: Dan Rathbun
      Operating system: Windows
      SketchUp version: 2013
      License type: Pro
      SketchUp use: education
      Level of SketchUp: Advanced

      Notepad++ Trick : Saving Ruby source as UTF-8

      Postby Dan Rathbun » Sun Feb 12, 2012 12:17 pm

        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.)
        User avatar
        Dan Rathbun
        Top SketchUcator
         
        Posts: 4097
        Joined: Tue Oct 06, 2009 3:06 am
        Location: Florida, USA
        Name: Dan Rathbun
        Operating system: Windows
        SketchUp version: 2013
        License type: Pro
        SketchUp use: education
        Level of SketchUp: Advanced

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

        Postby thomthom » Sun Feb 12, 2012 2:25 pm

        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
        User avatar
        thomthom
        Global Moderator
         
        Posts: 17673
        Joined: Tue Nov 13, 2007 12:47 pm
        Location: Trondheim, Norway
        Name: thomthom
        Operating system: Windows
        SketchUp version: 8
        License type: Pro
        SketchUp use: architecture
        Level of SketchUp: Advanced

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

        Postby Dan Rathbun » Sun Feb 12, 2012 2:30 pm

        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.
        User avatar
        Dan Rathbun
        Top SketchUcator
         
        Posts: 4097
        Joined: Tue Oct 06, 2009 3:06 am
        Location: Florida, USA
        Name: Dan Rathbun
        Operating system: Windows
        SketchUp version: 2013
        License type: Pro
        SketchUp use: education
        Level of SketchUp: Advanced

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

        Postby TIG » Sun Feb 12, 2012 3:10 pm

        Capture.PNG
        Seems to work fine on PC...
        Please, register (free) to access all the attachments on the forums.
        TIG
        User avatar
        TIG
        Global Moderator
         
        Posts: 14007
        Joined: Mon Nov 12, 2007 7:24 pm
        Location: Northumbria UK
        Name: TIG
        Operating system: Windows
        SketchUp version: 2013
        License type: Pro
        SketchUp use: architecture
        Level of SketchUp: Advanced

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

        Postby thomthom » Sun Feb 12, 2012 6:31 pm

        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
        User avatar
        thomthom
        Global Moderator
         
        Posts: 17673
        Joined: Tue Nov 13, 2007 12:47 pm
        Location: Trondheim, Norway
        Name: thomthom
        Operating system: Windows
        SketchUp version: 8
        License type: Pro
        SketchUp use: architecture
        Level of SketchUp: Advanced

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

        Postby Dan Rathbun » Sun Feb 12, 2012 7:22 pm

        thomthom wrote: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?
        User avatar
        Dan Rathbun
        Top SketchUcator
         
        Posts: 4097
        Joined: Tue Oct 06, 2009 3:06 am
        Location: Florida, USA
        Name: Dan Rathbun
        Operating system: Windows
        SketchUp version: 2013
        License type: Pro
        SketchUp use: education
        Level of SketchUp: Advanced

        Trick: Ruby Keywords update for langs.xml

        Postby Dan Rathbun » Wed Feb 15, 2012 12:59 pm

        Added an updated keywords list for the user (APPDATA) "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:
        Code: Select all
        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.
        User avatar
        Dan Rathbun
        Top SketchUcator
         
        Posts: 4097
        Joined: Tue Oct 06, 2009 3:06 am
        Location: Florida, USA
        Name: Dan Rathbun
        Operating system: Windows
        SketchUp version: 2013
        License type: Pro
        SketchUp use: education
        Level of SketchUp: Advanced

        Trick: User-Defined Ruby Keywords

        Postby Dan Rathbun » Sat Mar 10, 2012 8:10 pm


          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
          Please, register (free) to access all the attachments on the forums.
          User avatar
          Dan Rathbun
          Top SketchUcator
           
          Posts: 4097
          Joined: Tue Oct 06, 2009 3:06 am
          Location: Florida, USA
          Name: Dan Rathbun
          Operating system: Windows
          SketchUp version: 2013
          License type: Pro
          SketchUp use: education
          Level of SketchUp: Advanced

          Notepad++ Tip : customizing your context menu.

          Postby Dan Rathbun » Sat Jun 16, 2012 6:49 pm

          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:
          Code: Select all
          <!--
             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.):
          Code: Select all
           <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" />


          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".)
          Code: Select all
           <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" 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.
          Please, register (free) to access all the attachments on the forums.
          User avatar
          Dan Rathbun
          Top SketchUcator
           
          Posts: 4097
          Joined: Tue Oct 06, 2009 3:06 am
          Location: Florida, USA
          Name: Dan Rathbun
          Operating system: Windows
          SketchUp version: 2013
          License type: Pro
          SketchUp use: education
          Level of SketchUp: Advanced

          Notepad++ Trick : Getting your Compare panes to lineup

          Postby Dan Rathbun » Sat Jun 16, 2012 9:09 pm

            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.

            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.)

            :D
            User avatar
            Dan Rathbun
            Top SketchUcator
             
            Posts: 4097
            Joined: Tue Oct 06, 2009 3:06 am
            Location: Florida, USA
            Name: Dan Rathbun
            Operating system: Windows
            SketchUp version: 2013
            License type: Pro
            SketchUp use: education
            Level of SketchUp: Advanced

            SketchUcation One-Liner Adverts

            by Ad Machine » 5 minutes ago

            Vertex Tools for SketchUp. Take control over each vertex with this vertex editor for SketchUp.

            Premium Members get 20% discount!

            Ad Machine
            Robot
             
            Posts: 2012


            Return to Developers' Forum

            Who is online

            Users browsing this forum: No registered users and 6 guests