Wednesday, November 23, 2011

Re: Editing the jumplist

Taylor Hedberg, Wed 2011-11-23 @ 11:09:14-0500:
> Is there any way to manually add a position to the jumplist?
>
> I use a plugin that moves the cursor using cursor(), which does not
> update the jumplist. But I'd like to be able to return to the previous
> location with <C-O> after cursor() is called.
>
> My thought was to just modify the plugin so that it adds the current
> cursor position to the jumplist immediately before calling cursor() to
> set the new position. I tried this:
>
> execute 'normal!' line('.') . 'G'
>
> which at least adds the current line to the jumplist. But I'd like to
> recall the exact position (including the column), not just the line.
> There don't seem to be any motions that set the cursor column and update
> the jumplist, though.
>
> Any thoughts?

Right after sending this, I had the thought to use marks for this
purpose. It looks like you can manually set the '` mark (using m`),
which has the side effect of adding the marked position to the jumplist.

If anyone knows a better way to do this, though, I'd like to hear about
it.

No comments:

Post a Comment