Community
    • Login

    Feature Request / Question: Soft Wrap at Vertical Edge (Column 80) regardless of window size

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 5 Posters 346 Views
    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.
    • h-jangraH
      h-jangra @Thorsten Heuer
      last edited by

      @Thorsten-Heuer Though I didn’t used this much but I have added this in NppVim plugin you :set tw=60 and :wrap or gq motion. I am not sure how to set text width in notepad++.

      fml2F Thorsten HeuerT 3 Replies Last reply Reply Quote 0
      • fml2F
        fml2 @h-jangra
        last edited by

        @h-jangra said in Feature Request / Question: Soft Wrap at Vertical Edge (Column 80) regardless of window size:

        I have added this in NppVim plugin [. . .]I am not sure how to set text width in notepad++

        That’s interesting! I’d think that a NP++ plugin can only do things that are also possible in NP++ itself since the underlying engine is the same.

        CoisesC 1 Reply Last reply Reply Quote 0
        • Thorsten HeuerT
          Thorsten Heuer @h-jangra
          last edited by

          @h-jangra Bild1.png I apologize, but I can’t find a way to set “:set tw=60 and :wrap or gq” in “NppVim”. I’m not a very experienced user; perhaps I’m missing some basic knowledge.

          h-jangraH 2 Replies Last reply Reply Quote 0
          • h-jangraH
            h-jangra @Thorsten Heuer
            last edited by

            @Thorsten-Heuer You can set the text width in command mode by typing :set tw=80. This defines an 80-column wrap limit.

            After that, use V to select the line (visual line mode) and press gq to reflow it according to that column width.

            Currently, this setting isn’t persistent between sessions. If you’d like it to be configurable (similar to Vim), feel free to open an issue, I can look into adding support for it.

            1 Reply Last reply Reply Quote 0
            • h-jangraH
              h-jangra @Thorsten Heuer
              last edited by

              @Thorsten-Heuer
              You can set vertical edge though but then wrap will not work according to that.

              • Settings → Preferences → Margins/Border/Edge
              • Enable Vertical Edge
              • Set it to 80

              86b1a92a-f3ff-4215-b340-a558e78e6319-image.png

              1 Reply Last reply Reply Quote 0
              • fml2F
                fml2 @h-jangra
                last edited by

                @h-jangra I’ve tried it out:

                1. Installed the NppVim plugin
                2. entered the commands set tw=30 and wrap.

                After the first command, a thin vertical line is displayed at the position 30; the second command activates text wrapping. But, as in the “usual” NP++, the wrapping is made at the windows right edge, not at the width set with tw.

                It works exactly the same way it works in NP++ without NppVim. Which is not surprising because everything is backed by NP++ and Scintilla in the end.

                It’s very surprising that Scintilla does not have an option to soft wrap the text at a specified width (not window edge).

                CoisesC 1 Reply Last reply Reply Quote 0
                • CoisesC
                  Coises @fml2
                  last edited by

                  @fml2 said in Feature Request / Question: Soft Wrap at Vertical Edge (Column 80) regardless of window size:

                  It’s very surprising that Scintilla does not have an option to soft wrap the text at a specified width (not window edge).

                  I must be missing something… it’s very surprising to me that if this is important to you, you wouldn’t just resize the window so the edge is where you want the file to wrap.

                  Two alternatives (though I admit I don’t see why either would be better than just resizing the window):

                  • Open something in a docking panel, like View | Document Map, and drag the divider so that it lines up with the place you want to wrap.

                  • Open a new tab, move it to the second view, and drag the divider to the place you want to wrap.

                  M Andre Z EckenrodeM 1 Reply Last reply Reply Quote 0
                  • M Andre Z EckenrodeM
                    M Andre Z Eckenrode @Coises
                    last edited by

                    @Coises

                    Not that soft wrapping of text at a specified column other than window width is something I do, but I can think of a few reasons why one may wish to avoid resizing the window, particularly so that it’s only 80 columns wide, to accomplish the desired effect: So that the menus and tool bar aren’t adversely affected.

                    If I wanted to achieve custom soft wrapping myself, I’d prefer NOT changing my window size specifically because I prefer having NPP open in the same custom location and size every time I run it, and I’d have to reverse my window size changes before closing NPP in order to maintain that.

                    One could also increase the zoom level until the desired wrapping occurs, though that, too, would have the potentially negative side effect of reducing the amount of text visible at a time.

                    1 Reply Last reply Reply Quote 0
                    • CoisesC
                      Coises @fml2
                      last edited by

                      @fml2 said in Feature Request / Question: Soft Wrap at Vertical Edge (Column 80) regardless of window size:

                      That’s interesting! I’d think that a NP++ plugin can only do things that are also possible in NP++ itself since the underlying engine is the same.

                      There is a way to do it in Scintilla:
                      SCI_SETMARGINLEFT and SCI_SETMARGINRIGHT set margins, in pixels.

                      A plugin, or a PythonScript, could determine the displayable text width of the Scintilla control (I think that would require getting the client width of the Scintilla control with GetClientRect, then using SCI_GETMARGINS to find the number of active margins and iterating through them with SCI_GETMARGINWIDTHN to subtract the margins; there might be an easier way that hasn’t occurred to me) and the width of a string of characters of the desired length (SCI_TEXTWIDTH with style 0), subtract, divide by two and set that margin on each side.

                      fml2F 1 Reply Last reply Reply Quote 2
                      • fml2F
                        fml2 @Coises
                        last edited by

                        @Coises said in Feature Request / Question: Soft Wrap at Vertical Edge (Column 80) regardless of window size:

                        There is a way to do it in Scintilla:
                        SCI_SETMARGINLEFT and SCI_SETMARGINRIGHT set margins, in pixels.

                        Not that I’d use it much, but there were a couple of times I wished the feature was there. Now you have pointed out what the underlying engine can do for this (it works, I’ve checked!).

                        For the real life, it’s of no use though. Who would want to set the width in pixels? To be usable by an end user, it needs a script that would calculate pixel width for the current font and also handle widows resize.

                        These are just theoretical thoughts since you also advised a practicl way to set the desired width (with side panels).

                        Thank you!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors