are there side-effects to remapping/aliasing less to vim?












0















I added the following to .bashrc to remap less to vim



alias vsi='vim -R -c ":map Q :q!<enter>" -' # Vim Standard Input [readonly]
alias less='vsi'


the reason is that I don't want to maintain two config files with my key bindings preference, and I find vim more useful and predictable (often I can't find the looked-up text because it's not highlighted or not in view)



it seems that less was developed after vi and more, because they couldn't open "enormous" files, what was considered "enormous" back then that vi and more couldn't handle? and is it not an issue today?



will this alias break scripts or programs that depend on less?










share|improve this question





























    0















    I added the following to .bashrc to remap less to vim



    alias vsi='vim -R -c ":map Q :q!<enter>" -' # Vim Standard Input [readonly]
    alias less='vsi'


    the reason is that I don't want to maintain two config files with my key bindings preference, and I find vim more useful and predictable (often I can't find the looked-up text because it's not highlighted or not in view)



    it seems that less was developed after vi and more, because they couldn't open "enormous" files, what was considered "enormous" back then that vi and more couldn't handle? and is it not an issue today?



    will this alias break scripts or programs that depend on less?










    share|improve this question



























      0












      0








      0








      I added the following to .bashrc to remap less to vim



      alias vsi='vim -R -c ":map Q :q!<enter>" -' # Vim Standard Input [readonly]
      alias less='vsi'


      the reason is that I don't want to maintain two config files with my key bindings preference, and I find vim more useful and predictable (often I can't find the looked-up text because it's not highlighted or not in view)



      it seems that less was developed after vi and more, because they couldn't open "enormous" files, what was considered "enormous" back then that vi and more couldn't handle? and is it not an issue today?



      will this alias break scripts or programs that depend on less?










      share|improve this question
















      I added the following to .bashrc to remap less to vim



      alias vsi='vim -R -c ":map Q :q!<enter>" -' # Vim Standard Input [readonly]
      alias less='vsi'


      the reason is that I don't want to maintain two config files with my key bindings preference, and I find vim more useful and predictable (often I can't find the looked-up text because it's not highlighted or not in view)



      it seems that less was developed after vi and more, because they couldn't open "enormous" files, what was considered "enormous" back then that vi and more couldn't handle? and is it not an issue today?



      will this alias break scripts or programs that depend on less?







      vim alias vi less more






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 10 hours ago







      Wis

















      asked 11 hours ago









      WisWis

      33




      33






















          3 Answers
          3






          active

          oldest

          votes


















          0














          The viewing of incomplete input is an issue:



          seq 10000 | pv -qL 10 | less





          share|improve this answer































            0














            It could lead to unexpected behavior, for instance if the less command is issued with switches. I like to run less with the "-N" switch for line numbers, like so: less -N filename. When I alias less to vim, I don't get my expected line numbers (for vim, the "-N" switch is for "No-compatible mode" which makes vim "behave a bit better, but less Vi compatible" according the man page). Can you be confident your use case will never highlight less and vim's divergent behavior?






            share|improve this answer










            New contributor




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




























              0














              It will not break scripts or commands that depend on less since shell aliases would not be expanded for scripts or other commands.



              Shell aliases are only there for convenience in your interactive shell session. They are not carried over into shell scripts and commands that you start from that shell session because aliases are not part of the environment that is inherited by child processes.



              The only issue would be if you yourself forgot that you had this alias and then proceeded to use it with extra options in an interactive shell session. These options would then be given to vim.



              You may also consider using view rather than vim -R.





              Regarding "enormous files", these are files that are of sizes larger than your RAM, or at least of the same size a sizeable chunk of the available RAM. Traditionally, editors would load the whole file into memory as you opened them, and some still do this. Opening large files would therefore




              1. be slow

              2. potentially run the editor into a resource restriction (out of memory)


              I believe that the Vim editor is working around this using its "swap files" (the ones that you may have seen with the .swp filename suffix). See :help swap-file in Vim.



              The less pager will, by default, keep all read data in memory when reading from a pipe. If more data is read than there is available RAM for, you will have issues. Fortunately, there is a -B (or --auto-buffers) option that forces less to only keep the last portion of the read data in memory. However, this obviously makes it impossible to jump back to previously viewed lines of input.



              The more pager is sometimes less in disguise (just a hard link to the less binary). On systems where more is actual more, the pager does not allow scrolling backwards when viewing data read from pipes.



              Neither less nor more needs to read a file completely to be able to view the contents of it. Both would seek through the file to the appropriate location.






              share|improve this answer


























              • I just found that out about shell aliases, after going back to what I was doing before trying this (using man, which depends on less*). * archlinux.org/packages/core/x86_64/man-db I guess I must use `less', it's a dependency of many other programs (gzip etc.).

                – Wis
                9 hours ago











              • @Wis man itself is not dependent on less. man uses the variable PAGER or MANPAGER. If this is set to your vim command, then the manuals will be viewed by vim. I suppose that the dependency is there because using man without any pager would make it unusable (and less is the default pager). It would not be able to use an alias as the pager.

                – Kusalananda
                9 hours ago








              • 1





                finally, now I know exactly what i'm trying to do: use vim as a pager. ideally with all programs that I use which depend on less. you're right, I set $ PAGER='vim -R -c ":map Q :q!<enter>" -', and tried man, vim opened the page with caret characters, there are vim pager plugins, I'll just find or ask a question.

                – Wis
                9 hours ago











              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%2f505368%2fare-there-side-effects-to-remapping-aliasing-less-to-vim%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









              0














              The viewing of incomplete input is an issue:



              seq 10000 | pv -qL 10 | less





              share|improve this answer




























                0














                The viewing of incomplete input is an issue:



                seq 10000 | pv -qL 10 | less





                share|improve this answer


























                  0












                  0








                  0







                  The viewing of incomplete input is an issue:



                  seq 10000 | pv -qL 10 | less





                  share|improve this answer













                  The viewing of incomplete input is an issue:



                  seq 10000 | pv -qL 10 | less






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 10 hours ago









                  Ole TangeOle Tange

                  12.7k1455105




                  12.7k1455105

























                      0














                      It could lead to unexpected behavior, for instance if the less command is issued with switches. I like to run less with the "-N" switch for line numbers, like so: less -N filename. When I alias less to vim, I don't get my expected line numbers (for vim, the "-N" switch is for "No-compatible mode" which makes vim "behave a bit better, but less Vi compatible" according the man page). Can you be confident your use case will never highlight less and vim's divergent behavior?






                      share|improve this answer










                      New contributor




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

























                        0














                        It could lead to unexpected behavior, for instance if the less command is issued with switches. I like to run less with the "-N" switch for line numbers, like so: less -N filename. When I alias less to vim, I don't get my expected line numbers (for vim, the "-N" switch is for "No-compatible mode" which makes vim "behave a bit better, but less Vi compatible" according the man page). Can you be confident your use case will never highlight less and vim's divergent behavior?






                        share|improve this answer










                        New contributor




                        wurtzkurdle 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







                          It could lead to unexpected behavior, for instance if the less command is issued with switches. I like to run less with the "-N" switch for line numbers, like so: less -N filename. When I alias less to vim, I don't get my expected line numbers (for vim, the "-N" switch is for "No-compatible mode" which makes vim "behave a bit better, but less Vi compatible" according the man page). Can you be confident your use case will never highlight less and vim's divergent behavior?






                          share|improve this answer










                          New contributor




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










                          It could lead to unexpected behavior, for instance if the less command is issued with switches. I like to run less with the "-N" switch for line numbers, like so: less -N filename. When I alias less to vim, I don't get my expected line numbers (for vim, the "-N" switch is for "No-compatible mode" which makes vim "behave a bit better, but less Vi compatible" according the man page). Can you be confident your use case will never highlight less and vim's divergent behavior?







                          share|improve this answer










                          New contributor




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









                          share|improve this answer



                          share|improve this answer








                          edited 9 hours ago





















                          New contributor




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









                          answered 10 hours ago









                          wurtzkurdlewurtzkurdle

                          12




                          12




                          New contributor




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





                          New contributor





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






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























                              0














                              It will not break scripts or commands that depend on less since shell aliases would not be expanded for scripts or other commands.



                              Shell aliases are only there for convenience in your interactive shell session. They are not carried over into shell scripts and commands that you start from that shell session because aliases are not part of the environment that is inherited by child processes.



                              The only issue would be if you yourself forgot that you had this alias and then proceeded to use it with extra options in an interactive shell session. These options would then be given to vim.



                              You may also consider using view rather than vim -R.





                              Regarding "enormous files", these are files that are of sizes larger than your RAM, or at least of the same size a sizeable chunk of the available RAM. Traditionally, editors would load the whole file into memory as you opened them, and some still do this. Opening large files would therefore




                              1. be slow

                              2. potentially run the editor into a resource restriction (out of memory)


                              I believe that the Vim editor is working around this using its "swap files" (the ones that you may have seen with the .swp filename suffix). See :help swap-file in Vim.



                              The less pager will, by default, keep all read data in memory when reading from a pipe. If more data is read than there is available RAM for, you will have issues. Fortunately, there is a -B (or --auto-buffers) option that forces less to only keep the last portion of the read data in memory. However, this obviously makes it impossible to jump back to previously viewed lines of input.



                              The more pager is sometimes less in disguise (just a hard link to the less binary). On systems where more is actual more, the pager does not allow scrolling backwards when viewing data read from pipes.



                              Neither less nor more needs to read a file completely to be able to view the contents of it. Both would seek through the file to the appropriate location.






                              share|improve this answer


























                              • I just found that out about shell aliases, after going back to what I was doing before trying this (using man, which depends on less*). * archlinux.org/packages/core/x86_64/man-db I guess I must use `less', it's a dependency of many other programs (gzip etc.).

                                – Wis
                                9 hours ago











                              • @Wis man itself is not dependent on less. man uses the variable PAGER or MANPAGER. If this is set to your vim command, then the manuals will be viewed by vim. I suppose that the dependency is there because using man without any pager would make it unusable (and less is the default pager). It would not be able to use an alias as the pager.

                                – Kusalananda
                                9 hours ago








                              • 1





                                finally, now I know exactly what i'm trying to do: use vim as a pager. ideally with all programs that I use which depend on less. you're right, I set $ PAGER='vim -R -c ":map Q :q!<enter>" -', and tried man, vim opened the page with caret characters, there are vim pager plugins, I'll just find or ask a question.

                                – Wis
                                9 hours ago
















                              0














                              It will not break scripts or commands that depend on less since shell aliases would not be expanded for scripts or other commands.



                              Shell aliases are only there for convenience in your interactive shell session. They are not carried over into shell scripts and commands that you start from that shell session because aliases are not part of the environment that is inherited by child processes.



                              The only issue would be if you yourself forgot that you had this alias and then proceeded to use it with extra options in an interactive shell session. These options would then be given to vim.



                              You may also consider using view rather than vim -R.





                              Regarding "enormous files", these are files that are of sizes larger than your RAM, or at least of the same size a sizeable chunk of the available RAM. Traditionally, editors would load the whole file into memory as you opened them, and some still do this. Opening large files would therefore




                              1. be slow

                              2. potentially run the editor into a resource restriction (out of memory)


                              I believe that the Vim editor is working around this using its "swap files" (the ones that you may have seen with the .swp filename suffix). See :help swap-file in Vim.



                              The less pager will, by default, keep all read data in memory when reading from a pipe. If more data is read than there is available RAM for, you will have issues. Fortunately, there is a -B (or --auto-buffers) option that forces less to only keep the last portion of the read data in memory. However, this obviously makes it impossible to jump back to previously viewed lines of input.



                              The more pager is sometimes less in disguise (just a hard link to the less binary). On systems where more is actual more, the pager does not allow scrolling backwards when viewing data read from pipes.



                              Neither less nor more needs to read a file completely to be able to view the contents of it. Both would seek through the file to the appropriate location.






                              share|improve this answer


























                              • I just found that out about shell aliases, after going back to what I was doing before trying this (using man, which depends on less*). * archlinux.org/packages/core/x86_64/man-db I guess I must use `less', it's a dependency of many other programs (gzip etc.).

                                – Wis
                                9 hours ago











                              • @Wis man itself is not dependent on less. man uses the variable PAGER or MANPAGER. If this is set to your vim command, then the manuals will be viewed by vim. I suppose that the dependency is there because using man without any pager would make it unusable (and less is the default pager). It would not be able to use an alias as the pager.

                                – Kusalananda
                                9 hours ago








                              • 1





                                finally, now I know exactly what i'm trying to do: use vim as a pager. ideally with all programs that I use which depend on less. you're right, I set $ PAGER='vim -R -c ":map Q :q!<enter>" -', and tried man, vim opened the page with caret characters, there are vim pager plugins, I'll just find or ask a question.

                                – Wis
                                9 hours ago














                              0












                              0








                              0







                              It will not break scripts or commands that depend on less since shell aliases would not be expanded for scripts or other commands.



                              Shell aliases are only there for convenience in your interactive shell session. They are not carried over into shell scripts and commands that you start from that shell session because aliases are not part of the environment that is inherited by child processes.



                              The only issue would be if you yourself forgot that you had this alias and then proceeded to use it with extra options in an interactive shell session. These options would then be given to vim.



                              You may also consider using view rather than vim -R.





                              Regarding "enormous files", these are files that are of sizes larger than your RAM, or at least of the same size a sizeable chunk of the available RAM. Traditionally, editors would load the whole file into memory as you opened them, and some still do this. Opening large files would therefore




                              1. be slow

                              2. potentially run the editor into a resource restriction (out of memory)


                              I believe that the Vim editor is working around this using its "swap files" (the ones that you may have seen with the .swp filename suffix). See :help swap-file in Vim.



                              The less pager will, by default, keep all read data in memory when reading from a pipe. If more data is read than there is available RAM for, you will have issues. Fortunately, there is a -B (or --auto-buffers) option that forces less to only keep the last portion of the read data in memory. However, this obviously makes it impossible to jump back to previously viewed lines of input.



                              The more pager is sometimes less in disguise (just a hard link to the less binary). On systems where more is actual more, the pager does not allow scrolling backwards when viewing data read from pipes.



                              Neither less nor more needs to read a file completely to be able to view the contents of it. Both would seek through the file to the appropriate location.






                              share|improve this answer















                              It will not break scripts or commands that depend on less since shell aliases would not be expanded for scripts or other commands.



                              Shell aliases are only there for convenience in your interactive shell session. They are not carried over into shell scripts and commands that you start from that shell session because aliases are not part of the environment that is inherited by child processes.



                              The only issue would be if you yourself forgot that you had this alias and then proceeded to use it with extra options in an interactive shell session. These options would then be given to vim.



                              You may also consider using view rather than vim -R.





                              Regarding "enormous files", these are files that are of sizes larger than your RAM, or at least of the same size a sizeable chunk of the available RAM. Traditionally, editors would load the whole file into memory as you opened them, and some still do this. Opening large files would therefore




                              1. be slow

                              2. potentially run the editor into a resource restriction (out of memory)


                              I believe that the Vim editor is working around this using its "swap files" (the ones that you may have seen with the .swp filename suffix). See :help swap-file in Vim.



                              The less pager will, by default, keep all read data in memory when reading from a pipe. If more data is read than there is available RAM for, you will have issues. Fortunately, there is a -B (or --auto-buffers) option that forces less to only keep the last portion of the read data in memory. However, this obviously makes it impossible to jump back to previously viewed lines of input.



                              The more pager is sometimes less in disguise (just a hard link to the less binary). On systems where more is actual more, the pager does not allow scrolling backwards when viewing data read from pipes.



                              Neither less nor more needs to read a file completely to be able to view the contents of it. Both would seek through the file to the appropriate location.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 9 hours ago

























                              answered 10 hours ago









                              KusalanandaKusalananda

                              134k17255418




                              134k17255418













                              • I just found that out about shell aliases, after going back to what I was doing before trying this (using man, which depends on less*). * archlinux.org/packages/core/x86_64/man-db I guess I must use `less', it's a dependency of many other programs (gzip etc.).

                                – Wis
                                9 hours ago











                              • @Wis man itself is not dependent on less. man uses the variable PAGER or MANPAGER. If this is set to your vim command, then the manuals will be viewed by vim. I suppose that the dependency is there because using man without any pager would make it unusable (and less is the default pager). It would not be able to use an alias as the pager.

                                – Kusalananda
                                9 hours ago








                              • 1





                                finally, now I know exactly what i'm trying to do: use vim as a pager. ideally with all programs that I use which depend on less. you're right, I set $ PAGER='vim -R -c ":map Q :q!<enter>" -', and tried man, vim opened the page with caret characters, there are vim pager plugins, I'll just find or ask a question.

                                – Wis
                                9 hours ago



















                              • I just found that out about shell aliases, after going back to what I was doing before trying this (using man, which depends on less*). * archlinux.org/packages/core/x86_64/man-db I guess I must use `less', it's a dependency of many other programs (gzip etc.).

                                – Wis
                                9 hours ago











                              • @Wis man itself is not dependent on less. man uses the variable PAGER or MANPAGER. If this is set to your vim command, then the manuals will be viewed by vim. I suppose that the dependency is there because using man without any pager would make it unusable (and less is the default pager). It would not be able to use an alias as the pager.

                                – Kusalananda
                                9 hours ago








                              • 1





                                finally, now I know exactly what i'm trying to do: use vim as a pager. ideally with all programs that I use which depend on less. you're right, I set $ PAGER='vim -R -c ":map Q :q!<enter>" -', and tried man, vim opened the page with caret characters, there are vim pager plugins, I'll just find or ask a question.

                                – Wis
                                9 hours ago

















                              I just found that out about shell aliases, after going back to what I was doing before trying this (using man, which depends on less*). * archlinux.org/packages/core/x86_64/man-db I guess I must use `less', it's a dependency of many other programs (gzip etc.).

                              – Wis
                              9 hours ago





                              I just found that out about shell aliases, after going back to what I was doing before trying this (using man, which depends on less*). * archlinux.org/packages/core/x86_64/man-db I guess I must use `less', it's a dependency of many other programs (gzip etc.).

                              – Wis
                              9 hours ago













                              @Wis man itself is not dependent on less. man uses the variable PAGER or MANPAGER. If this is set to your vim command, then the manuals will be viewed by vim. I suppose that the dependency is there because using man without any pager would make it unusable (and less is the default pager). It would not be able to use an alias as the pager.

                              – Kusalananda
                              9 hours ago







                              @Wis man itself is not dependent on less. man uses the variable PAGER or MANPAGER. If this is set to your vim command, then the manuals will be viewed by vim. I suppose that the dependency is there because using man without any pager would make it unusable (and less is the default pager). It would not be able to use an alias as the pager.

                              – Kusalananda
                              9 hours ago






                              1




                              1





                              finally, now I know exactly what i'm trying to do: use vim as a pager. ideally with all programs that I use which depend on less. you're right, I set $ PAGER='vim -R -c ":map Q :q!<enter>" -', and tried man, vim opened the page with caret characters, there are vim pager plugins, I'll just find or ask a question.

                              – Wis
                              9 hours ago





                              finally, now I know exactly what i'm trying to do: use vim as a pager. ideally with all programs that I use which depend on less. you're right, I set $ PAGER='vim -R -c ":map Q :q!<enter>" -', and tried man, vim opened the page with caret characters, there are vim pager plugins, I'll just find or ask a question.

                              – Wis
                              9 hours ago


















                              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.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f505368%2fare-there-side-effects-to-remapping-aliasing-less-to-vim%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

                              Loup dans la culture

                              How to solve the problem of ntp “Unable to contact time server” from KDE?

                              ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux