Save/restore cursor location upon fold close/open

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











up vote
0
down vote

favorite












When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.



I assume I could remap zc and za to create a mark at the current cursor position as a sort of PreFoldClose hook, and then I could remap zo and za to move the cursor to said mark as a sort of PostFoldOpen hook.



But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?



Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview command?









share

























    up vote
    0
    down vote

    favorite












    When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.



    I assume I could remap zc and za to create a mark at the current cursor position as a sort of PreFoldClose hook, and then I could remap zo and za to move the cursor to said mark as a sort of PostFoldOpen hook.



    But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?



    Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview command?









    share























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.



      I assume I could remap zc and za to create a mark at the current cursor position as a sort of PreFoldClose hook, and then I could remap zo and za to move the cursor to said mark as a sort of PostFoldOpen hook.



      But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?



      Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview command?









      share













      When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.



      I assume I could remap zc and za to create a mark at the current cursor position as a sort of PreFoldClose hook, and then I could remap zo and za to move the cursor to said mark as a sort of PostFoldOpen hook.



      But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?



      Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview command?







      vim





      share












      share










      share



      share










      asked 7 mins ago









      courtyardz

      133




      133

























          active

          oldest

          votes











          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%2f475486%2fsave-restore-cursor-location-upon-fold-close-open%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475486%2fsave-restore-cursor-location-upon-fold-close-open%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?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?