Menu

how to turn on code folding by default

pete shaw
2006-01-11
2012-11-13
  • pete shaw

    pete shaw - 2006-01-11

    Hello,

    Does anyone know how I can get notepad++ to fold text on plain text files?  Currently I am just loading text files and then setting the language to VB. 

    thanks.  I really love this editor!
    --Pete

     
    • Nobody/Anonymous

      hello?  Is there anybody out there who could please spare a moment to answer this trivial and yet frustrating question? 

       
    • Paulius

      Paulius - 2006-01-14

      Notepad++ text folding is based on the block-start and block-end which depends on the syntax of current language (in C/C++ they are "{" and "}", in pascal they are "begin" and "end" etc).
      Plain text doesn't have any syntax at all, so there are no blocks. If there are no blocks, there is nothing to fold? The only definition of a "block" in plain-text files i could think of would be "paragraph", but that is not supported in current version of Notepad++ (and i do not think this will be added soon, because there are higher priority features to be implemented).

       
      • Don HO

        Don HO - 2006-01-14

        That's right.

        So if you can define the block opening symbol and block closing symbol in your plein text, you can use User Language Define System to have the folding feature. Otherwise, non.

        Don

         
        • pete shaw

          pete shaw - 2006-01-16

          OK,  thanks for your replies, but this helps to some degree, but I still think my question is unanswered.

          I am trying to get plain text files to fold in the same way that vb files do currently, possibly without all of the same text highlighting rules.

          Now, the first place I looked was in the Styler Configurator, thinking that this would allow me to view the settings for VB and apply them to the default for plain text.  But in the style configurator, there are only entries for DEFAULT, COMMENT, NUMBER, WORD, STRING, PREPROCCESSOR, OPERATOR, and DATE.  None of these seem to affect code foldin, only colors for various keywords.  Interestingly, while you can change the colors for these styles, you cannot add or remove the styles themselves from this screen. 

          The next place I looked was in the styler.xml file, which took some looking because it was stored in local settings.  I then opened up the
          stylers.xml file, which listed all of the files, but didn't have any kind of a block opening or block closing tag.

          I then went and looked at the various xml files in the program directory itself.  OK, I even found a langs.xml file.

          But this is even stranger-- the langs.xml lists an entry for vb, but it doesn't list any kind of block opening or closing symbol at all.  Instead it lists commentStart as "" and commentEnd as "".  It also lists commentLine as "REM" when I would think it would be "'" for VB or VBscript. 

          Despite all this, when I load up a text file with a .vb extension, or set the language to VB, I am able to fold text based on tabbed indentation, which is exactly what I want, (only for text files).

          Also, interestingly, when editing a vb file, it detects a ' comment properly, so it must be defined somewhere else

          Anyway, sorry for going on at lenght here but I am just trying to weed my way through this.  I do appreciate all of your help.

           
          • Nobody/Anonymous

            The UserDefineDialog box can be brought up with the menu icon to the left of the macro recording button. It took me a while to find that option since it seems to only be in the picture menu bar and not in the normal drop down menus.

            Since your .txt syntax highlighting/folding should be fairly simple, starting a new language from scratch and assigning .txt to it is probably the easiest way to go.

            -rv

             
          • pete shaw

            pete shaw - 2006-01-19

            okay, since maybe that was too much information, let a couple simple questions:

            if I delete a language entry from langs.xml, how come it still shows up in the Language menu?  Are the languages hardcoded? 

            For that matter, in the absence of any documentation on how the language def system works, is there any other way I could learn about this? 

            thanks
            --Pete

             
            • Nobody/Anonymous

              I, too, would love to learn how to achieve folding on indented text--even if I must (heaven forbid), use my own begin and end block characters.  This would allow for a crude, but abundantly useful text/task outliner.

              If anyone figures this out, puhleeeeezee email me at:

                tom@footeworks.us

              Many thanks!

              Tom

               
    • cognacc

      cognacc - 2006-01-20

      Ok i did it by making my own "language" via
      the user define dialog. its the sixth icon from the right, at least on my computer, it is a standard install on Win 2000.

      then i created a language: user language "text"

      with the extension. Ext: txt

      under the tab: Folder & default
      in the section: folder Open Keywords Setting:
      I put a { in the textfield (because i lack imagination?)
      in the section: folder Open Keywords Setting:
      I put a } in the textfield

      Done

      you can now do

      -Shoppinglistfolded {

      }

      But you have to have a space between the text and
      the start brace, you can also just put the start brace down on next line.
      You don't have to do that if you choose a predefined language like C or VB.
      But haven't found a way to get out of it in userdefined language.

      But anyway this takes precedence over the Normal Text language type.

      remember to check this link though.

      http://notepad-plus.sourceforge.net/uk/UserLanguageDefineSystem-HOWTO.php

      Have a nice day!
      Michael

       
    • Nobody/Anonymous

      Would be nice to have code folding in other
      than programming files by folding from bookmark to bookmark.

      Or if N++ detect folding points
      by an special char combination
      like this regex ^#:#$
      or by an combination like {#}
      or what else.

      --
      Stefan