How to save marks in less for later access?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
3
down vote

favorite












If I mark a line in less, the mark will lost when the current less session ends.



So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.



Seems like less doesn't have any config files. Is there a way to save the marks in less so I can use it for next time?







share|improve this question



























    up vote
    3
    down vote

    favorite












    If I mark a line in less, the mark will lost when the current less session ends.



    So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.



    Seems like less doesn't have any config files. Is there a way to save the marks in less so I can use it for next time?







    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      If I mark a line in less, the mark will lost when the current less session ends.



      So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.



      Seems like less doesn't have any config files. Is there a way to save the marks in less so I can use it for next time?







      share|improve this question













      If I mark a line in less, the mark will lost when the current less session ends.



      So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.



      Seems like less doesn't have any config files. Is there a way to save the marks in less so I can use it for next time?









      share|improve this question












      share|improve this question




      share|improve this question








      edited Jul 27 at 9:57









      Jeff Schaller

      30.7k846104




      30.7k846104









      asked Jul 27 at 2:41









      dotc

      163




      163




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          Not in the version of less I looked at. Another problem is that man may write to temporary files, so how would the marks line up between /tmp/man.sLCaUQkJ3k and /tmp/man.yuvNSUrFZo even if they were being saved?



          We can cheat a little and use vim which does with suitable configuration save marks for future use, and also use the same filename for each man page. Note that a system-wide temporary directory would most likely be a very bad place to put static filenames, unless you like generating new CVE.



          function mman col -bx > "$HOME/tmp/man.$1"
          vim -R "$HOME/tmp/man.$1"
          #rm "$HOME/tmp/man.$1"



          The generated page could either be removed immediately, or maybe a cron job cleans them up. Another problem is that man section names or other arguments to man are not supported, so this code may likely need to be complicated to handle man 3 rand the same as man rand (though those two may not be the same depending on your system and whether the OpenSSL rand man page intrudes).






          share|improve this answer





















          • Please specify your version of less.
            – agc
            Jul 27 at 3:57

















          up vote
          0
          down vote













          There are no way to preserve the marks across invocations... But:




          So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.




          less saves search history by default. It stores it in ~/.lesshst, which can be overridden by setting the $LESSHISTFILE environment variable to point to another file's path. So at least you can use that to search for a regexp you used before (assuming you're using that same one often.) I hope you might find that useful (in case you didn't know about it.)






          share|improve this answer





















            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f458734%2fhow-to-save-marks-in-less-for-later-access%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            Not in the version of less I looked at. Another problem is that man may write to temporary files, so how would the marks line up between /tmp/man.sLCaUQkJ3k and /tmp/man.yuvNSUrFZo even if they were being saved?



            We can cheat a little and use vim which does with suitable configuration save marks for future use, and also use the same filename for each man page. Note that a system-wide temporary directory would most likely be a very bad place to put static filenames, unless you like generating new CVE.



            function mman col -bx > "$HOME/tmp/man.$1"
            vim -R "$HOME/tmp/man.$1"
            #rm "$HOME/tmp/man.$1"



            The generated page could either be removed immediately, or maybe a cron job cleans them up. Another problem is that man section names or other arguments to man are not supported, so this code may likely need to be complicated to handle man 3 rand the same as man rand (though those two may not be the same depending on your system and whether the OpenSSL rand man page intrudes).






            share|improve this answer





















            • Please specify your version of less.
              – agc
              Jul 27 at 3:57














            up vote
            0
            down vote













            Not in the version of less I looked at. Another problem is that man may write to temporary files, so how would the marks line up between /tmp/man.sLCaUQkJ3k and /tmp/man.yuvNSUrFZo even if they were being saved?



            We can cheat a little and use vim which does with suitable configuration save marks for future use, and also use the same filename for each man page. Note that a system-wide temporary directory would most likely be a very bad place to put static filenames, unless you like generating new CVE.



            function mman col -bx > "$HOME/tmp/man.$1"
            vim -R "$HOME/tmp/man.$1"
            #rm "$HOME/tmp/man.$1"



            The generated page could either be removed immediately, or maybe a cron job cleans them up. Another problem is that man section names or other arguments to man are not supported, so this code may likely need to be complicated to handle man 3 rand the same as man rand (though those two may not be the same depending on your system and whether the OpenSSL rand man page intrudes).






            share|improve this answer





















            • Please specify your version of less.
              – agc
              Jul 27 at 3:57












            up vote
            0
            down vote










            up vote
            0
            down vote









            Not in the version of less I looked at. Another problem is that man may write to temporary files, so how would the marks line up between /tmp/man.sLCaUQkJ3k and /tmp/man.yuvNSUrFZo even if they were being saved?



            We can cheat a little and use vim which does with suitable configuration save marks for future use, and also use the same filename for each man page. Note that a system-wide temporary directory would most likely be a very bad place to put static filenames, unless you like generating new CVE.



            function mman col -bx > "$HOME/tmp/man.$1"
            vim -R "$HOME/tmp/man.$1"
            #rm "$HOME/tmp/man.$1"



            The generated page could either be removed immediately, or maybe a cron job cleans them up. Another problem is that man section names or other arguments to man are not supported, so this code may likely need to be complicated to handle man 3 rand the same as man rand (though those two may not be the same depending on your system and whether the OpenSSL rand man page intrudes).






            share|improve this answer













            Not in the version of less I looked at. Another problem is that man may write to temporary files, so how would the marks line up between /tmp/man.sLCaUQkJ3k and /tmp/man.yuvNSUrFZo even if they were being saved?



            We can cheat a little and use vim which does with suitable configuration save marks for future use, and also use the same filename for each man page. Note that a system-wide temporary directory would most likely be a very bad place to put static filenames, unless you like generating new CVE.



            function mman col -bx > "$HOME/tmp/man.$1"
            vim -R "$HOME/tmp/man.$1"
            #rm "$HOME/tmp/man.$1"



            The generated page could either be removed immediately, or maybe a cron job cleans them up. Another problem is that man section names or other arguments to man are not supported, so this code may likely need to be complicated to handle man 3 rand the same as man rand (though those two may not be the same depending on your system and whether the OpenSSL rand man page intrudes).







            share|improve this answer













            share|improve this answer



            share|improve this answer











            answered Jul 27 at 3:55









            thrig

            21.8k12651




            21.8k12651











            • Please specify your version of less.
              – agc
              Jul 27 at 3:57
















            • Please specify your version of less.
              – agc
              Jul 27 at 3:57















            Please specify your version of less.
            – agc
            Jul 27 at 3:57




            Please specify your version of less.
            – agc
            Jul 27 at 3:57












            up vote
            0
            down vote













            There are no way to preserve the marks across invocations... But:




            So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.




            less saves search history by default. It stores it in ~/.lesshst, which can be overridden by setting the $LESSHISTFILE environment variable to point to another file's path. So at least you can use that to search for a regexp you used before (assuming you're using that same one often.) I hope you might find that useful (in case you didn't know about it.)






            share|improve this answer

























              up vote
              0
              down vote













              There are no way to preserve the marks across invocations... But:




              So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.




              less saves search history by default. It stores it in ~/.lesshst, which can be overridden by setting the $LESSHISTFILE environment variable to point to another file's path. So at least you can use that to search for a regexp you used before (assuming you're using that same one often.) I hope you might find that useful (in case you didn't know about it.)






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                There are no way to preserve the marks across invocations... But:




                So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.




                less saves search history by default. It stores it in ~/.lesshst, which can be overridden by setting the $LESSHISTFILE environment variable to point to another file's path. So at least you can use that to search for a regexp you used before (assuming you're using that same one often.) I hope you might find that useful (in case you didn't know about it.)






                share|improve this answer













                There are no way to preserve the marks across invocations... But:




                So, let's say, if I often check the bash man page for READLINE section, I have to search ^REA every time.




                less saves search history by default. It stores it in ~/.lesshst, which can be overridden by setting the $LESSHISTFILE environment variable to point to another file's path. So at least you can use that to search for a regexp you used before (assuming you're using that same one often.) I hope you might find that useful (in case you didn't know about it.)







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered Jul 27 at 6:18









                Filipe Brandenburger

                2,894417




                2,894417






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f458734%2fhow-to-save-marks-in-less-for-later-access%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay