Wednesday, November 23, 2011

Editing the jumplist

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?

No comments: