Smart word wrapping in `less`?












2














I use the Python package rtv as a terminal client to read Reddit. When it gets to a large text box, it calls less display the text. Currently, less wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?










share|improve this question






















  • No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
    – matzeri
    Jul 21 '16 at 14:39
















2














I use the Python package rtv as a terminal client to read Reddit. When it gets to a large text box, it calls less display the text. Currently, less wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?










share|improve this question






















  • No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
    – matzeri
    Jul 21 '16 at 14:39














2












2








2







I use the Python package rtv as a terminal client to read Reddit. When it gets to a large text box, it calls less display the text. Currently, less wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?










share|improve this question













I use the Python package rtv as a terminal client to read Reddit. When it gets to a large text box, it calls less display the text. Currently, less wraps the words according to column width, meaning that sometimes you get cut off in the middle of the word. Is there a configuration or tweak that can make it only fold where there is whitespace?







linux bash terminal cygwin less






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 20 '16 at 18:22









Ed Doe

111




111












  • No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
    – matzeri
    Jul 21 '16 at 14:39


















  • No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
    – matzeri
    Jul 21 '16 at 14:39
















No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39




No. But you can ask the author for it at [link] (greenwoodsoftware.com/less/bugs.html)
– matzeri
Jul 21 '16 at 14:39










3 Answers
3






active

oldest

votes


















2














One solution is to use the -S (--chop-long-lines) command line option for less. This tells less to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.



You can enable this behavior by adding -S to the command line or setting the environment variable, LESS, like this in Bash:



$ export LESS='-S'


More on word wrapping can be found in this question: How to turn off word-wrap in less






share|improve this answer































    1














    Put this in your .bashrc or similar configuration file.



    export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""






    share|improve this answer





























      0














      I use the unix toolbox for my terminal/bash viewer:



      alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'





      share|improve this answer





















      • What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
        – Scott
        Dec 3 at 20:25











      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1103256%2fsmart-word-wrapping-in-less%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      One solution is to use the -S (--chop-long-lines) command line option for less. This tells less to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.



      You can enable this behavior by adding -S to the command line or setting the environment variable, LESS, like this in Bash:



      $ export LESS='-S'


      More on word wrapping can be found in this question: How to turn off word-wrap in less






      share|improve this answer




























        2














        One solution is to use the -S (--chop-long-lines) command line option for less. This tells less to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.



        You can enable this behavior by adding -S to the command line or setting the environment variable, LESS, like this in Bash:



        $ export LESS='-S'


        More on word wrapping can be found in this question: How to turn off word-wrap in less






        share|improve this answer


























          2












          2








          2






          One solution is to use the -S (--chop-long-lines) command line option for less. This tells less to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.



          You can enable this behavior by adding -S to the command line or setting the environment variable, LESS, like this in Bash:



          $ export LESS='-S'


          More on word wrapping can be found in this question: How to turn off word-wrap in less






          share|improve this answer














          One solution is to use the -S (--chop-long-lines) command line option for less. This tells less to truncate lines to the width of the screen. To view the truncated lines that are wider than the terminal, the left and right arrow keys can be used to scroll the window horizontally.



          You can enable this behavior by adding -S to the command line or setting the environment variable, LESS, like this in Bash:



          $ export LESS='-S'


          More on word wrapping can be found in this question: How to turn off word-wrap in less







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 20 '17 at 10:17









          Community

          1




          1










          answered Jul 22 '16 at 0:07









          Stephen Balousek

          17614




          17614

























              1














              Put this in your .bashrc or similar configuration file.



              export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""






              share|improve this answer


























                1














                Put this in your .bashrc or similar configuration file.



                export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""






                share|improve this answer
























                  1












                  1








                  1






                  Put this in your .bashrc or similar configuration file.



                  export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""






                  share|improve this answer












                  Put this in your .bashrc or similar configuration file.



                  export PAGER="/bin/sh -c "fmt -s -w $(tput cols) - | less""







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 14 '17 at 19:23









                  ASaylover3156

                  111




                  111























                      0














                      I use the unix toolbox for my terminal/bash viewer:



                      alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'





                      share|improve this answer





















                      • What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
                        – Scott
                        Dec 3 at 20:25
















                      0














                      I use the unix toolbox for my terminal/bash viewer:



                      alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'





                      share|improve this answer





















                      • What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
                        – Scott
                        Dec 3 at 20:25














                      0












                      0








                      0






                      I use the unix toolbox for my terminal/bash viewer:



                      alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'





                      share|improve this answer












                      I use the unix toolbox for my terminal/bash viewer:



                      alias v='(fold -s -w75 | nl -bn -w10 | LESS= less -MINRz-4+G:1g)<'






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Dec 3 at 20:03









                      sbin_bash

                      1




                      1












                      • What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
                        – Scott
                        Dec 3 at 20:25


















                      • What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
                        – Scott
                        Dec 3 at 20:25
















                      What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
                      – Scott
                      Dec 3 at 20:25




                      What does that do? How would one use it? Please do not respond in comments; edit your answer to make it clearer and more complete.
                      – Scott
                      Dec 3 at 20:25


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1103256%2fsmart-word-wrapping-in-less%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Список кардиналов, возведённых папой римским Каликстом III

                      Deduzione

                      Mysql.sock missing - “Can't connect to local MySQL server through socket”