Thursday, November 1, 2012

Re: saving code browsing history

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...@gmail.com>
>
> >
>
> > > 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

No comments: