Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push a location to the jumplist

Tags:

vim

vim-plugin

My vim plugin has a command to jump to a different location (just like tags).

I use the cursor function for that.

How do I record the previous location in the jumplist, so that Ctrl+O works as expected?

like image 462
Roman Cheplyaka Avatar asked Oct 05 '13 07:10

Roman Cheplyaka


1 Answers

I myself also wanted to this, and what works for me was mark ` before cursor move.

normal! m`
call cursor(l, c)

As help indicate, both setpos() and cursor() don't modify jumplist, so what's the difference of setpos() and cursor(), strange!

like image 61
t9md Avatar answered Sep 30 '22 06:09

t9md