The marks in vim
knows the deletion and insertion of lines before it and their positions will keep updated. Is there a way to achieve these pragmatically?
I am running an async task which is supposed to update the current line when the task finishes. Here the current line means the cursor line at the time the task is launched. After launching it, I may need to move the cursor around; make modifications to the buffer. How can I get the correct position when the task finishes without using a mark? If marks are used, they may be accidentally reset by user or by other third party plugins.
example
Given the text:
line1
line2
fix me please
line4
line5
Assume my cursor is now at line 3, I am going to run :Fixme
which is to replace fix me please
with line3
but at a much later time.
If during this waiting period, I delete line1
or inserte more lines before line 3, I hope :Fixme
is aware of this change and still updates the line fix me please
. How to achieve this?