Loading ...
Sorry, an error occurred while loading the content.

saving code browsing history

Expand Messages
  • happyFace
    Hi, I have been using vim for sometime now but I am completely new to writing vim plugins. I would like to write a plugin that record all the file locations we
    Message 1 of 4 , Oct 30, 2012
    • 0 Attachment
      Hi,

      I have been using vim for sometime now but I am completely new to writing vim plugins. I would like to write a plugin that record all the file locations we jump to (with tags or cscope symbols) and save them in a file. So that we can later review the "code browsing session" and be able to conveniently revisit the same tags we browsed.

      I know ":tags" can give us the tags stack but I want also to save cscope symbols accessed.

      The only way I can think of for doing this is to remap ctrl+], tag <pattern>, cs find g <pattern>, etc to my own functions which will then do two things:
      1- jump to the new tag, symbol.
      2- record the location, tag, etc

      Is there a better way to go about this? Better yet, is there an existing plugin for this? I could not find any. The closest I found are ":tags" for the tag stack, ":history" for the list of commands history, Taglist plugin but this displays all tags in a file, it doesn't record only those visited...

      Thanks,
      E.S.


      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Asis Hallab
      2012/10/31 happyFace ... Hi! Vim already has that feature. It s called the jumplist. Couldn t be better explained than by Drew
      Message 2 of 4 , Oct 31, 2012
      • 0 Attachment
        2012/10/31 happyFace <happyface.tcsh2002@...>
        Hi,

        I have been using vim for sometime now but I am completely new to writing vim plugins. I would like to write a plugin that record all the file locations we jump to (with tags or cscope symbols) and save them in a file. So that we can later review the "code browsing session" and be able to conveniently revisit the same tags we browsed.

        Hi!

        Vim already has that feature. It's called the jumplist.
        Couldn't be better explained than by Drew Neil:

        There is also a switch to make Vim save its history. 
        So after restarting it, you still have your old jumplist.
        You can set it in your vimrc, unfortunately I can't remember it right now..

        Cheers!
         

        I know ":tags" can give us the tags stack but I want also to save cscope symbols accessed.

        The only way I can think of for doing this is to remap ctrl+], tag <pattern>, cs find g <pattern>, etc to my own functions which will then do two things:
        1- jump to the new tag, symbol.
        2- record the location, tag, etc

        Is there a better way to go about this? Better yet, is there an existing plugin for this? I could not find any. The closest I found are ":tags" for the tag stack, ":history" for the list of commands history, Taglist plugin but this displays all tags in a file, it doesn't record only those visited...

        Thanks,
        E.S.


        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Ben Fritz
        ... Vim saves the jumplist in the .viminfo file, if the included by default in the viminfo option is still present. However, the .viminfo file may not be
        Message 3 of 4 , Oct 31, 2012
        • 0 Attachment
          On Wednesday, October 31, 2012 2:32:49 AM UTC-5, Asis Hallab wrote:
          > 2012/10/31 happyFace <happyface...@...>
          >
          > > I have been using vim for sometime now but I am completely new to writing
          > > vim plugins. I would like to write a plugin that record all the file
          > > locations we jump to (with tags or cscope symbols) and save them in a file.
          > > So that we can later review the "code browsing session" and be able to
          > > conveniently revisit the same tags we browsed.
          >
          >
          > Vim already has that feature. It's called the jumplist.
          > Couldn't be better explained than by Drew Neil:
          > http://vimcasts.org/episodes/using-the-changelist-and-jumplist/
          >
          >
          >
          > There is also a switch to make Vim save its history. 
          > So after restarting it, you still have your old jumplist.
          > You can set it in your vimrc, unfortunately I can't remember it right now..
          >

          Vim saves the jumplist in the .viminfo file, if the "'" included by default in
          the 'viminfo' option is still present.

          However, the .viminfo file may not be as persistent a storage location as you
          might like. Additionally, according to the help only 100 jumps are stored in the
          list, and each window has its own jump list. The :jumps command will list out
          the current jump list (presumably for the current window). Potentially you could
          use :redir to capture and parse the output of this command and store it to a
          file of your choosing. I don't see any functions to get the jumplist in a
          script, but perhaps I just missed them.

          Actually, rather than parsing the output of :jumps, it is probably better to set
          'viminfo' to the desired setting, use the :wviminfo command with a file
          argument, then restore 'viminfo'.

          I don't know of a better way to accomplish your task than using the jump list,
          even with the caveats I mention above. Hopefully 100 jumps will be sufficient
          for you.

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • happyFace
          ... Thanks guys! ... I use gnome terminal where I set telnet -E dev-server-name as a command to be automatically executed when a terminal is launched. I set
          Message 4 of 4 , Nov 1, 2012
          • 0 Attachment
            On Wednesday, October 31, 2012 7:52:18 AM UTC-7, Ben Fritz wrote:
            > On Wednesday, October 31, 2012 2:32:49 AM UTC-5, Asis Hallab wrote:
            >
            > > 2012/10/31 happyFace <happyface...@...>
            >
            > >
            >
            > > > I have been using vim for sometime now but I am completely new to writing
            >
            > > > vim plugins. I would like to write a plugin that record all the file
            >
            > > > locations we jump to (with tags or cscope symbols) and save them in a file.
            >
            > > > So that we can later review the "code browsing session" and be able to
            >
            > > > conveniently revisit the same tags we browsed.
            >
            > >
            >
            > >
            >
            > > Vim already has that feature. It's called the jumplist.
            >
            > > Couldn't be better explained than by Drew Neil:
            >
            > > http://vimcasts.org/episodes/using-the-changelist-and-jumplist/
            >
            > >
            >
            > >
            >
            > >
            >
            > > There is also a switch to make Vim save its history. 
            >
            > > So after restarting it, you still have your old jumplist.
            >
            > > You can set it in your vimrc, unfortunately I can't remember it right now..
            >
            > >
            >
            >
            >
            > Vim saves the jumplist in the .viminfo file, if the "'" included by default in
            >
            > the 'viminfo' option is still present.
            >
            >
            >
            > However, the .viminfo file may not be as persistent a storage location as you
            >
            > might like. Additionally, according to the help only 100 jumps are stored in the
            >
            > list, and each window has its own jump list. The :jumps command will list out
            >
            > the current jump list (presumably for the current window). Potentially you could
            >
            > use :redir to capture and parse the output of this command and store it to a
            >
            > file of your choosing. I don't see any functions to get the jumplist in a
            >
            > script, but perhaps I just missed them.
            >
            >
            >
            > Actually, rather than parsing the output of :jumps, it is probably better to set
            >
            > 'viminfo' to the desired setting, use the :wviminfo command with a file
            >
            > argument, then restore 'viminfo'.
            >
            >
            >
            > I don't know of a better way to accomplish your task than using the jump list,
            >
            > even with the caveats I mention above. Hopefully 100 jumps will be sufficient
            >
            > for you.

            Thanks guys!

            :jumps is great. I struggled a bit with getting ctrl-o, ctrl-i to work. I would type those but nothing happens. I finally found a workaround without quite understanding the cause of the problem.

            I use gnome terminal where I set "telnet -E dev-server-name" as a command to be automatically executed when a terminal is launched. I set that in the terminal profile.

            I use -E to force telnet not to recognize any escape character, otherwise, ctrl-] will close the telnet session instead of jumping to the tag definition in a vim session. Somehow, this was causing ctrl-o, ctrl-i not to function at all.

            If I set "telnet dev-server-name" instead of "telnet -E dev-server-name", then ctrl-o, ctrl-i work fine.

            What makes this even more difficult to understand is that if I ssh to the development server and then telnet -E to the same server, ctrl-o, ctrl-i works fine in a vim session!

            Only if I use telnet -E ** and ** I set it in the gnome terminal profile to be launched when a terminal is launched do I hit the problem of ctrl-o, ctrl-i not working in a vim session.

            Anyway, I have a workaround. Just wanted to share that in case someone hits the same problem.

            ES

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          Your message has been successfully submitted and would be delivered to recipients shortly.