How do I make nano act like vi when it comes to text wrapping?












1














When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.



How can I make nano behave like vi when it becomes to this feature?










share|improve this question





























    1














    When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.



    How can I make nano behave like vi when it becomes to this feature?










    share|improve this question



























      1












      1








      1







      When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.



      How can I make nano behave like vi when it becomes to this feature?










      share|improve this question















      When using vi and long lines, the text are wrap but vi doesn't insert a CR/LF at the end of the line. With nano, if I start typing and the line becomes too long, it will insert CR/LF at the end of the line.



      How can I make nano behave like vi when it becomes to this feature?







      vi newlines nano






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 5 '17 at 23:56









      Gilles

      528k12810571583




      528k12810571583










      asked Sep 5 '17 at 23:40









      mrjayviper

      4971619




      4971619






















          4 Answers
          4






          active

          oldest

          votes


















          2














          Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.



          To disable this feature in nano, press Alt+L. In nvi, set wraplen and wrapmagin to 0 (:set wl=0 wm=0).



          Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.



          If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.



          ¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.






          share|improve this answer





















          • yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
            – mrjayviper
            Sep 6 '17 at 0:49



















          1














          https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char



          answered by @Marco Ceppi:




          Nano Install Nano is a little easier. You can launch nano with the -L
          flag (or --nonewlines if you're more the visual type). This will
          disable the automatic addition of the newline to the end of the file
          (so long as one was not actually entered). Ideally you could setup
          this alias in your ~/.bashrc: alias nanon=nano -L which would launch
          Nano with the no newlines flag included in it.







          share|improve this answer





























            1














            Open the nanorc generally at ~/.nanorc or /etc/nanorc, comment out the line



            set nowrap


            And uncomment line



            set softwrap


            Hope it helps.






            share|improve this answer























            • Note: This only works for nano 2 and not nano 3. Since nano 2, set nowrap no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap and continue to hardwrap if set nowrap isn't added. So add both set nowrap and set softwrap for textwrapping that doesn't break your files.
              – x0a
              4 mins ago





















            0














            The wrapping behavior of nano 1, nano 2, and nano 3 differs.



            On nano 1, you only have the set nowrap setting which disables all wrapping.



            On nano 2, set softwrap enables softwrapping and disables hardwrapping.



            On nano 3, set softwrap is ignored and nano continues to hardwrap unless you also set set nowrap.



            So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc



            set nowrap
            set softwrap




            share








            New contributor




            x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.


















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "106"
              };
              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: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              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%2funix.stackexchange.com%2fquestions%2f390585%2fhow-do-i-make-nano-act-like-vi-when-it-comes-to-text-wrapping%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.



              To disable this feature in nano, press Alt+L. In nvi, set wraplen and wrapmagin to 0 (:set wl=0 wm=0).



              Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.



              If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.



              ¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.






              share|improve this answer





















              • yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
                – mrjayviper
                Sep 6 '17 at 0:49
















              2














              Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.



              To disable this feature in nano, press Alt+L. In nvi, set wraplen and wrapmagin to 0 (:set wl=0 wm=0).



              Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.



              If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.



              ¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.






              share|improve this answer





















              • yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
                – mrjayviper
                Sep 6 '17 at 0:49














              2












              2








              2






              Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.



              To disable this feature in nano, press Alt+L. In nvi, set wraplen and wrapmagin to 0 (:set wl=0 wm=0).



              Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.



              If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.



              ¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.






              share|improve this answer












              Both nano and (most implementations of) vi have an optional line wrapping feature, where they replace the previous space by a line break¹ when the line becomes longer than a certain length. They behave differently when the cursor isn't at the end of the line, but it's fundamentally the same feature.



              To disable this feature in nano, press Alt+L. In nvi, set wraplen and wrapmagin to 0 (:set wl=0 wm=0).



              Vim also has a number of more advanced wrapping features which nano doesn't have an equivalent for.



              If a line is too wide for the terminal, vi shows it wrapped by the terminal. Nano doesn't, you need to scroll left and right. If that's what you meant by “act like vi”, you're out of luck.



              ¹ Not a CR/LF. CR/LF is the encoding of line breaks on Windows. On Unix, a line break is encoded as LF.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 5 '17 at 23:56









              Gilles

              528k12810571583




              528k12810571583












              • yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
                – mrjayviper
                Sep 6 '17 at 0:49


















              • yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
                – mrjayviper
                Sep 6 '17 at 0:49
















              yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
              – mrjayviper
              Sep 6 '17 at 0:49




              yes, I meant the scrolling left/right to see the contents if the line is too long for the terminal window. On vi, it wraps around (but no line breaks).
              – mrjayviper
              Sep 6 '17 at 0:49













              1














              https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char



              answered by @Marco Ceppi:




              Nano Install Nano is a little easier. You can launch nano with the -L
              flag (or --nonewlines if you're more the visual type). This will
              disable the automatic addition of the newline to the end of the file
              (so long as one was not actually entered). Ideally you could setup
              this alias in your ~/.bashrc: alias nanon=nano -L which would launch
              Nano with the no newlines flag included in it.







              share|improve this answer


























                1














                https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char



                answered by @Marco Ceppi:




                Nano Install Nano is a little easier. You can launch nano with the -L
                flag (or --nonewlines if you're more the visual type). This will
                disable the automatic addition of the newline to the end of the file
                (so long as one was not actually entered). Ideally you could setup
                this alias in your ~/.bashrc: alias nanon=nano -L which would launch
                Nano with the no newlines flag included in it.







                share|improve this answer
























                  1












                  1








                  1






                  https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char



                  answered by @Marco Ceppi:




                  Nano Install Nano is a little easier. You can launch nano with the -L
                  flag (or --nonewlines if you're more the visual type). This will
                  disable the automatic addition of the newline to the end of the file
                  (so long as one was not actually entered). Ideally you could setup
                  this alias in your ~/.bashrc: alias nanon=nano -L which would launch
                  Nano with the no newlines flag included in it.







                  share|improve this answer












                  https://askubuntu.com/questions/13317/how-to-stop-gedit-gvim-vim-nano-from-adding-end-of-file-newline-char



                  answered by @Marco Ceppi:




                  Nano Install Nano is a little easier. You can launch nano with the -L
                  flag (or --nonewlines if you're more the visual type). This will
                  disable the automatic addition of the newline to the end of the file
                  (so long as one was not actually entered). Ideally you could setup
                  this alias in your ~/.bashrc: alias nanon=nano -L which would launch
                  Nano with the no newlines flag included in it.








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 5 '17 at 23:53









                  NOP

                  1184




                  1184























                      1














                      Open the nanorc generally at ~/.nanorc or /etc/nanorc, comment out the line



                      set nowrap


                      And uncomment line



                      set softwrap


                      Hope it helps.






                      share|improve this answer























                      • Note: This only works for nano 2 and not nano 3. Since nano 2, set nowrap no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap and continue to hardwrap if set nowrap isn't added. So add both set nowrap and set softwrap for textwrapping that doesn't break your files.
                        – x0a
                        4 mins ago


















                      1














                      Open the nanorc generally at ~/.nanorc or /etc/nanorc, comment out the line



                      set nowrap


                      And uncomment line



                      set softwrap


                      Hope it helps.






                      share|improve this answer























                      • Note: This only works for nano 2 and not nano 3. Since nano 2, set nowrap no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap and continue to hardwrap if set nowrap isn't added. So add both set nowrap and set softwrap for textwrapping that doesn't break your files.
                        – x0a
                        4 mins ago
















                      1












                      1








                      1






                      Open the nanorc generally at ~/.nanorc or /etc/nanorc, comment out the line



                      set nowrap


                      And uncomment line



                      set softwrap


                      Hope it helps.






                      share|improve this answer














                      Open the nanorc generally at ~/.nanorc or /etc/nanorc, comment out the line



                      set nowrap


                      And uncomment line



                      set softwrap


                      Hope it helps.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Aug 24 at 11:59









                      GAD3R

                      25.4k1750106




                      25.4k1750106










                      answered Aug 24 at 10:22









                      Prashant Shubham

                      312




                      312












                      • Note: This only works for nano 2 and not nano 3. Since nano 2, set nowrap no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap and continue to hardwrap if set nowrap isn't added. So add both set nowrap and set softwrap for textwrapping that doesn't break your files.
                        – x0a
                        4 mins ago




















                      • Note: This only works for nano 2 and not nano 3. Since nano 2, set nowrap no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap and continue to hardwrap if set nowrap isn't added. So add both set nowrap and set softwrap for textwrapping that doesn't break your files.
                        – x0a
                        4 mins ago


















                      Note: This only works for nano 2 and not nano 3. Since nano 2, set nowrap no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap and continue to hardwrap if set nowrap isn't added. So add both set nowrap and set softwrap for textwrapping that doesn't break your files.
                      – x0a
                      4 mins ago






                      Note: This only works for nano 2 and not nano 3. Since nano 2, set nowrap no longer disables all wrapping, only hardwrapping, which is what the asker wants. And nano 3 will ignore set softwrap and continue to hardwrap if set nowrap isn't added. So add both set nowrap and set softwrap for textwrapping that doesn't break your files.
                      – x0a
                      4 mins ago













                      0














                      The wrapping behavior of nano 1, nano 2, and nano 3 differs.



                      On nano 1, you only have the set nowrap setting which disables all wrapping.



                      On nano 2, set softwrap enables softwrapping and disables hardwrapping.



                      On nano 3, set softwrap is ignored and nano continues to hardwrap unless you also set set nowrap.



                      So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc



                      set nowrap
                      set softwrap




                      share








                      New contributor




                      x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.























                        0














                        The wrapping behavior of nano 1, nano 2, and nano 3 differs.



                        On nano 1, you only have the set nowrap setting which disables all wrapping.



                        On nano 2, set softwrap enables softwrapping and disables hardwrapping.



                        On nano 3, set softwrap is ignored and nano continues to hardwrap unless you also set set nowrap.



                        So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc



                        set nowrap
                        set softwrap




                        share








                        New contributor




                        x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.





















                          0












                          0








                          0






                          The wrapping behavior of nano 1, nano 2, and nano 3 differs.



                          On nano 1, you only have the set nowrap setting which disables all wrapping.



                          On nano 2, set softwrap enables softwrapping and disables hardwrapping.



                          On nano 3, set softwrap is ignored and nano continues to hardwrap unless you also set set nowrap.



                          So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc



                          set nowrap
                          set softwrap




                          share








                          New contributor




                          x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          The wrapping behavior of nano 1, nano 2, and nano 3 differs.



                          On nano 1, you only have the set nowrap setting which disables all wrapping.



                          On nano 2, set softwrap enables softwrapping and disables hardwrapping.



                          On nano 3, set softwrap is ignored and nano continues to hardwrap unless you also set set nowrap.



                          So if you want text wrapping for long lines that doesn't break your configuration files (softwrapping only), this works for versions 2 and 3: ~/.nanorc



                          set nowrap
                          set softwrap





                          share








                          New contributor




                          x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.








                          share


                          share






                          New contributor




                          x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 2 mins ago









                          x0a

                          1011




                          1011




                          New contributor




                          x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          x0a is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • 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%2funix.stackexchange.com%2fquestions%2f390585%2fhow-do-i-make-nano-act-like-vi-when-it-comes-to-text-wrapping%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

                              Accessing regular linux commands in Huawei's Dopra Linux

                              Can't connect RFCOMM socket: Host is down

                              Kernel panic - not syncing: Fatal Exception in Interrupt