I want to save multiple positions in vimscript, and make sure that they stay at the right place, even after the buffer changes Here are the solutions I found so far, and why I want something else:

  • Save them in an array
    If lines are added by the user above the saved positions, they become incorrect (see below GIF, the gray position line 5 is the saved pos) demo saving positions

  • Position marks This works better, but there's a limit of saveable position (52 for the 26 uppercases letters and 26 lowercases), and the user would be able to change them, I don't want that...demo saving marks

  • Position signs I haven't tried this one yet, but I don't really like it because it sets unnecessary signs on the left side of the editor, and it doesn't save the horizontal position...

1 Answer 1


What about the new text-properties? They seem to have the property (sic) to follow.

Text properties can be attached to text in a buffer. They will move with the text: If lines are deleted or inserted the properties move with the text they are attached to. Also when inserting/deleting text in the line before the text property.

  • That looks great.... but I'm using NeoVim, and it's not available yet
    – Zorzi
    Mar 20, 2020 at 14:02
  • 2
    The text "stickiness" you seek had to be coded into Vim 8.2 and is otherwise impossible AFAIK.
    – B Layer
    Mar 21, 2020 at 7:49
  • for neovim, try the extended marks Mar 21, 2020 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.