Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

BSD Cafe Billboard

  1. Home
  2. BSD Cafe Lounge
  3. Unwrap Text (Preserve Paragraphs) ― an extension for Visual Studio Code

Unwrap Text (Preserve Paragraphs) ― an extension for Visual Studio Code

Scheduled Pinned Locked Moved BSD Cafe Lounge
vscodeanthropicclaudesonnetreddit
11 Posts 3 Posters 183 Views 1 Watching
  • 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.
  • grahamperrinG Offline
    grahamperrinG Offline
    grahamperrin
    wrote last edited by
    #1

    https://www.reddit.com/r/VSCodeExtensions/comments/1vzp09x/unwrap_text_preserve_paragraphs_extension_created/

    On various occasions I sought, but failed to find, an extension that:

    • unwraps text (removes line endings) and
    • preserves blank (empty) lines between paragraphs.

    After another fruitless search today, …

    Result:

    I tested the extension with a selection of text that comprised three paragraphs. Success.

    lproven@social.vivaldi.netL gumnos@mastodon.bsd.cafeG 2 Replies Last reply
    2
    0
    • grahamperrin@mastodon.bsd.cafeG grahamperrin@mastodon.bsd.cafe shared this topic
      G grahamperrin@mastodon.social shared this topic
    • grahamperrinG grahamperrin

      https://www.reddit.com/r/VSCodeExtensions/comments/1vzp09x/unwrap_text_preserve_paragraphs_extension_created/

      On various occasions I sought, but failed to find, an extension that:

      • unwraps text (removes line endings) and
      • preserves blank (empty) lines between paragraphs.

      After another fruitless search today, …

      Result:

      I tested the extension with a selection of text that comprised three paragraphs. Success.

      lproven@social.vivaldi.netL This user is from outside of this forum
      lproven@social.vivaldi.netL This user is from outside of this forum
      lproven@social.vivaldi.net
      wrote last edited by
      #2

      @grahamperrin

      Step 0: check your document does not contain the word "aardvark"

      Step 1: replace 2 [newline]s in a row with "aardvark"

      Step 2: replace [newline] with [space]

      Step 3: replace [two spaces] with [1 space]

      Repeat step 3 until no matches are found.

      Step 4: replace "aarvark" with 2 [newline]s

      End.

      grahamperrinG 1 Reply Last reply
      -1
      • grahamperrinG grahamperrin

        https://www.reddit.com/r/VSCodeExtensions/comments/1vzp09x/unwrap_text_preserve_paragraphs_extension_created/

        On various occasions I sought, but failed to find, an extension that:

        • unwraps text (removes line endings) and
        • preserves blank (empty) lines between paragraphs.

        After another fruitless search today, …

        Result:

        I tested the extension with a selection of text that comprised three paragraphs. Success.

        gumnos@mastodon.bsd.cafeG This user is from outside of this forum
        gumnos@mastodon.bsd.cafeG This user is from outside of this forum
        gumnos@mastodon.bsd.cafe
        wrote last edited by
        #3

        @grahamperrin

        so recreating fmt(1) or par(1) as a VSCode plugin? 😆

        (or Vim's gq command?)

        grahamperrinG 1 Reply Last reply
        0
        • lproven@social.vivaldi.netL lproven@social.vivaldi.net

          @grahamperrin

          Step 0: check your document does not contain the word "aardvark"

          Step 1: replace 2 [newline]s in a row with "aardvark"

          Step 2: replace [newline] with [space]

          Step 3: replace [two spaces] with [1 space]

          Repeat step 3 until no matches are found.

          Step 4: replace "aarvark" with 2 [newline]s

          End.

          grahamperrinG Offline
          grahamperrinG Offline
          grahamperrin
          wrote last edited by
          #4

          @lproven@social.vivaldi.net said:

          End.

          Additional background, for readers who might not read the chat.

          1. Numerous fruitless searches over a period of many months
          2. today I used Zotero on Kubuntu to make an addition to the FreeBSD collection in my shared library
          3. for an abstract, I copied three paragraphs from Firefox, the result was messy
          4. in VSCode, for the umpteenth time, I was frustrated by the inability to get what I want with a single step
          5. more searches
          6. I experimented with an extension that lacked the required feature – IIRC its description was misleading
          7. I uninstalled the extension
          8. more searches
          9. I experimented with a different extension that did only part of what I want
          10. more searches
          11. thanks to Claude, which created what neither I nor Claude could find in the marketplace, I gained what was required
          12. I used the new extension in VSCode
          13. the result (the abstract in Zotero) is not messy
          14. I'm no longer frustrated.

          The end? Hopefully not.

          Someone else might benefit, might be less frustrated, as a result of the streamlining.

          A single step (using the new extension), instead of multiple steps.

          lproven@social.vivaldi.netL 1 Reply Last reply
          0
          • gumnos@mastodon.bsd.cafeG gumnos@mastodon.bsd.cafe

            @grahamperrin

            so recreating fmt(1) or par(1) as a VSCode plugin? 😆

            (or Vim's gq command?)

            grahamperrinG Offline
            grahamperrinG Offline
            grahamperrin
            wrote last edited by
            #5

            @gumnos@mastodon.bsd.cafe said:

            … fmt(1) or par(1)

            I have only one of those:

            grahamperrin@mowa219-gjp4 ~> man fmt
            grahamperrin@mowa219-gjp4 ~> man par
            No manual entry for par
            grahamperrin@mowa219-gjp4 ~ [16]> par
            Command 'par' not found, but can be installed with:
            sudo apt install par
            grahamperrin@mowa219-gjp4 ~ [127]> 
            

            Ubuntu Manpage: fmt - Reformat paragraphs from input (or standard input) to stdout.

            – that's too complicated for me.

            … Vim's …

            I was a vocal hater of vi(1) before I switched from FreeBSD to Kubuntu.

            Ubuntu includes nano, which was my preferred text editor on FreeBSD (editors/nano is GPLv3, so we can't expect the Project to include it with the base system).

            Frustration with vi is not an isolated incident:

            • How do I leave this fucking editor? : r/AlpineLinux

            I ran vim for the first time in Kubuntu, then escaped. Naturally, my first run will be my last 😆

            gumnos@mastodon.bsd.cafeG 1 Reply Last reply
            0
            • grahamperrinG grahamperrin

              @gumnos@mastodon.bsd.cafe said:

              … fmt(1) or par(1)

              I have only one of those:

              grahamperrin@mowa219-gjp4 ~> man fmt
              grahamperrin@mowa219-gjp4 ~> man par
              No manual entry for par
              grahamperrin@mowa219-gjp4 ~ [16]> par
              Command 'par' not found, but can be installed with:
              sudo apt install par
              grahamperrin@mowa219-gjp4 ~ [127]> 
              

              Ubuntu Manpage: fmt - Reformat paragraphs from input (or standard input) to stdout.

              – that's too complicated for me.

              … Vim's …

              I was a vocal hater of vi(1) before I switched from FreeBSD to Kubuntu.

              Ubuntu includes nano, which was my preferred text editor on FreeBSD (editors/nano is GPLv3, so we can't expect the Project to include it with the base system).

              Frustration with vi is not an isolated incident:

              • How do I leave this fucking editor? : r/AlpineLinux

              I ran vim for the first time in Kubuntu, then escaped. Naturally, my first run will be my last 😆

              gumnos@mastodon.bsd.cafeG This user is from outside of this forum
              gumnos@mastodon.bsd.cafeG This user is from outside of this forum
              gumnos@mastodon.bsd.cafe
              wrote last edited by gumnos@mastodon.bsd.cafe
              #6

              @grahamperrin

              > I only have one of those

              Yeah, IIRC fmt(1) tends to be more broadly available while par(1) takes some of those ideas and makes them more powerful¹ (handling quoted email text, adjusting/not-adjusting spacing after periods, and a bunch of other knobs you can twiddle) at the cost of complex options.

              I just set my $PARINIT env variable (snagged from around the web to handle inter-sentence-spacing the way I want) and invoke it as "par" without needing to provide additional details.

              And both work fine from any $EDITOR that allows for passing a region of text through an external process. It looks like nano has an "execute" command² that, if the first character is a pipe, will replace the buffer/region with the results, so not just vi/vim or emacs. 🙂

              ⸻
              ¹ https://manpages.org/par
              ² https://www.nano-editor.org/dist/latest/nano.html bound to ^T by default

              1 Reply Last reply
              0
              • grahamperrinG Offline
                grahamperrinG Offline
                grahamperrin
                wrote last edited by
                #7

                My favourite editor last century was TextWrangler, which became BBEdit.

                BBEdit's Text Handling Features | Bare Bones Software

                Then, I abandoned Mac OS X, and I never found an comparable editor that did what I wanted out of the box (or with an extension).

                Now, eleven years later, I'm happy.

                1 Reply Last reply
                0
                • grahamperrinG grahamperrin

                  @lproven@social.vivaldi.net said:

                  End.

                  Additional background, for readers who might not read the chat.

                  1. Numerous fruitless searches over a period of many months
                  2. today I used Zotero on Kubuntu to make an addition to the FreeBSD collection in my shared library
                  3. for an abstract, I copied three paragraphs from Firefox, the result was messy
                  4. in VSCode, for the umpteenth time, I was frustrated by the inability to get what I want with a single step
                  5. more searches
                  6. I experimented with an extension that lacked the required feature – IIRC its description was misleading
                  7. I uninstalled the extension
                  8. more searches
                  9. I experimented with a different extension that did only part of what I want
                  10. more searches
                  11. thanks to Claude, which created what neither I nor Claude could find in the marketplace, I gained what was required
                  12. I used the new extension in VSCode
                  13. the result (the abstract in Zotero) is not messy
                  14. I'm no longer frustrated.

                  The end? Hopefully not.

                  Someone else might benefit, might be less frustrated, as a result of the streamlining.

                  A single step (using the new extension), instead of multiple steps.

                  lproven@social.vivaldi.netL This user is from outside of this forum
                  lproven@social.vivaldi.netL This user is from outside of this forum
                  lproven@social.vivaldi.net
                  wrote last edited by
                  #8

                  @grahamperrin

                  Honestly I never knew this was something so hard that anyone wouldn't be able to just... work it out. Sorry.

                  There are import tools in a number of word processors that can do things like it. I don't know what you searched for, or how you searched, but I'd think this was a very FA sort of Q.

                  The FOSS fundies will not like me saying this, but I find MS Word one of the very best tools for search-and-replace operations like this.

                  It has magic character combinations. The only ones I usually use, I memorised decades ago:

                  ^p = newline
                  ^t = tab
                  Space is just a space... so to remove extra spaces, in the "Search for" box, enter 2 spaces, and in the "Replace with" box, one. Then hit "Replace all", and repeat until it says there were no matches.

                  grahamperrinG 1 Reply Last reply
                  0
                  • lproven@social.vivaldi.netL lproven@social.vivaldi.net

                    @grahamperrin

                    Honestly I never knew this was something so hard that anyone wouldn't be able to just... work it out. Sorry.

                    There are import tools in a number of word processors that can do things like it. I don't know what you searched for, or how you searched, but I'd think this was a very FA sort of Q.

                    The FOSS fundies will not like me saying this, but I find MS Word one of the very best tools for search-and-replace operations like this.

                    It has magic character combinations. The only ones I usually use, I memorised decades ago:

                    ^p = newline
                    ^t = tab
                    Space is just a space... so to remove extra spaces, in the "Search for" box, enter 2 spaces, and in the "Replace with" box, one. Then hit "Replace all", and repeat until it says there were no matches.

                    grahamperrinG Offline
                    grahamperrinG Offline
                    grahamperrin
                    wrote last edited by
                    #9

                    grahamperrin said:

                    A single step … instead of multiple steps.

                    @lproven@social.vivaldi.net said:

                    … and repeat until …

                    Repetition is not a single step.

                    lproven@social.vivaldi.netL 1 Reply Last reply
                    0
                    • grahamperrinG grahamperrin

                      grahamperrin said:

                      A single step … instead of multiple steps.

                      @lproven@social.vivaldi.net said:

                      … and repeat until …

                      Repetition is not a single step.

                      lproven@social.vivaldi.netL This user is from outside of this forum
                      lproven@social.vivaldi.netL This user is from outside of this forum
                      lproven@social.vivaldi.net
                      wrote last edited by
                      #10

                      @grahamperrin Oh come off it. You could just record a macro, and do this in about 1kB.

                      1 Reply Last reply
                      -1
                      • grahamperrinG Offline
                        grahamperrinG Offline
                        grahamperrin
                        wrote last edited by
                        #11

                        @lproven@social.vivaldi.net you're still missing the point.

                        1 Reply Last reply
                        0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Login or register to search.
                        Powered by NodeBB Contributors
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups