Stack line numbers/file locations in vi












0















A lot of the time I'm reading through code and going from function to function, simulating a call stack. Once I get to the bottom, I need to work my way backwards to see how the returned values are handled, but often times I've forgotten what function (10 or so calls up) was called or where it was in the file.



I recently discovered I can walk through the find history with /^ (forward slash up-arrow). This works, but doesn't always get me exactly what I need.



Is there a way to "bookmark", in order, a list of locations so that I can walk through them in either direction? For example:




  • Line 100 - read_desc calls desc_read_dev

  • Line 1200 - desc_read_dev calls dev_read

  • Line 200 - dev_read calls out

  • Line 10 - out returns EOK


I'd then like to walk that EOK back up to dev_read and see what happens there, then walk that back to desc_read_dev etc.










share|improve this question



























    0















    A lot of the time I'm reading through code and going from function to function, simulating a call stack. Once I get to the bottom, I need to work my way backwards to see how the returned values are handled, but often times I've forgotten what function (10 or so calls up) was called or where it was in the file.



    I recently discovered I can walk through the find history with /^ (forward slash up-arrow). This works, but doesn't always get me exactly what I need.



    Is there a way to "bookmark", in order, a list of locations so that I can walk through them in either direction? For example:




    • Line 100 - read_desc calls desc_read_dev

    • Line 1200 - desc_read_dev calls dev_read

    • Line 200 - dev_read calls out

    • Line 10 - out returns EOK


    I'd then like to walk that EOK back up to dev_read and see what happens there, then walk that back to desc_read_dev etc.










    share|improve this question

























      0












      0








      0








      A lot of the time I'm reading through code and going from function to function, simulating a call stack. Once I get to the bottom, I need to work my way backwards to see how the returned values are handled, but often times I've forgotten what function (10 or so calls up) was called or where it was in the file.



      I recently discovered I can walk through the find history with /^ (forward slash up-arrow). This works, but doesn't always get me exactly what I need.



      Is there a way to "bookmark", in order, a list of locations so that I can walk through them in either direction? For example:




      • Line 100 - read_desc calls desc_read_dev

      • Line 1200 - desc_read_dev calls dev_read

      • Line 200 - dev_read calls out

      • Line 10 - out returns EOK


      I'd then like to walk that EOK back up to dev_read and see what happens there, then walk that back to desc_read_dev etc.










      share|improve this question














      A lot of the time I'm reading through code and going from function to function, simulating a call stack. Once I get to the bottom, I need to work my way backwards to see how the returned values are handled, but often times I've forgotten what function (10 or so calls up) was called or where it was in the file.



      I recently discovered I can walk through the find history with /^ (forward slash up-arrow). This works, but doesn't always get me exactly what I need.



      Is there a way to "bookmark", in order, a list of locations so that I can walk through them in either direction? For example:




      • Line 100 - read_desc calls desc_read_dev

      • Line 1200 - desc_read_dev calls dev_read

      • Line 200 - dev_read calls out

      • Line 10 - out returns EOK


      I'd then like to walk that EOK back up to dev_read and see what happens there, then walk that back to desc_read_dev etc.







      vim vi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 25 at 14:56









      Brydon GibsonBrydon Gibson

      377213




      377213






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Do you know the :help jumplist?



          Every search (with /, and n/N) and also other motions (that cover more than a short distance, so j, w, etc are out) adds an entry there, and you can go back with <C-O>, and forward again with <C-I> (which is the same as <Tab>).



          You can also explicitly set a jump point via m'.



          And tags



          As your use case is navigation through a call stack, I'd also like to highlight the related tag stack. You need to generate a database of function definitions first (ctags supports many programming languages), and then there are commands for tag lookup, jumps, and going back in the stack. (All of that is recorded as regular jumps as well.) See :help tags for details.



          Advanced stage



          You probably don't need this as a beginner, but plugins like my EnhancedJumps plugin extend the built-in jumplist with jumps that stay inside the current buffer, or the opposite, directly jump to the next location in another buffer.






          share|improve this answer























            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%2f1398401%2fstack-line-numbers-file-locations-in-vi%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Do you know the :help jumplist?



            Every search (with /, and n/N) and also other motions (that cover more than a short distance, so j, w, etc are out) adds an entry there, and you can go back with <C-O>, and forward again with <C-I> (which is the same as <Tab>).



            You can also explicitly set a jump point via m'.



            And tags



            As your use case is navigation through a call stack, I'd also like to highlight the related tag stack. You need to generate a database of function definitions first (ctags supports many programming languages), and then there are commands for tag lookup, jumps, and going back in the stack. (All of that is recorded as regular jumps as well.) See :help tags for details.



            Advanced stage



            You probably don't need this as a beginner, but plugins like my EnhancedJumps plugin extend the built-in jumplist with jumps that stay inside the current buffer, or the opposite, directly jump to the next location in another buffer.






            share|improve this answer




























              1














              Do you know the :help jumplist?



              Every search (with /, and n/N) and also other motions (that cover more than a short distance, so j, w, etc are out) adds an entry there, and you can go back with <C-O>, and forward again with <C-I> (which is the same as <Tab>).



              You can also explicitly set a jump point via m'.



              And tags



              As your use case is navigation through a call stack, I'd also like to highlight the related tag stack. You need to generate a database of function definitions first (ctags supports many programming languages), and then there are commands for tag lookup, jumps, and going back in the stack. (All of that is recorded as regular jumps as well.) See :help tags for details.



              Advanced stage



              You probably don't need this as a beginner, but plugins like my EnhancedJumps plugin extend the built-in jumplist with jumps that stay inside the current buffer, or the opposite, directly jump to the next location in another buffer.






              share|improve this answer


























                1












                1








                1







                Do you know the :help jumplist?



                Every search (with /, and n/N) and also other motions (that cover more than a short distance, so j, w, etc are out) adds an entry there, and you can go back with <C-O>, and forward again with <C-I> (which is the same as <Tab>).



                You can also explicitly set a jump point via m'.



                And tags



                As your use case is navigation through a call stack, I'd also like to highlight the related tag stack. You need to generate a database of function definitions first (ctags supports many programming languages), and then there are commands for tag lookup, jumps, and going back in the stack. (All of that is recorded as regular jumps as well.) See :help tags for details.



                Advanced stage



                You probably don't need this as a beginner, but plugins like my EnhancedJumps plugin extend the built-in jumplist with jumps that stay inside the current buffer, or the opposite, directly jump to the next location in another buffer.






                share|improve this answer













                Do you know the :help jumplist?



                Every search (with /, and n/N) and also other motions (that cover more than a short distance, so j, w, etc are out) adds an entry there, and you can go back with <C-O>, and forward again with <C-I> (which is the same as <Tab>).



                You can also explicitly set a jump point via m'.



                And tags



                As your use case is navigation through a call stack, I'd also like to highlight the related tag stack. You need to generate a database of function definitions first (ctags supports many programming languages), and then there are commands for tag lookup, jumps, and going back in the stack. (All of that is recorded as regular jumps as well.) See :help tags for details.



                Advanced stage



                You probably don't need this as a beginner, but plugins like my EnhancedJumps plugin extend the built-in jumplist with jumps that stay inside the current buffer, or the opposite, directly jump to the next location in another buffer.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 25 at 15:10









                Ingo KarkatIngo Karkat

                17.7k22646




                17.7k22646






























                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398401%2fstack-line-numbers-file-locations-in-vi%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

                    Сан-Квентин

                    8-я гвардейская общевойсковая армия

                    Алькесар