neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.54k stars 120 forks source link

modify line without deleting marks? #511

Closed ces42 closed 2 years ago

ces42 commented 2 years ago

When modifying a line (by doing py3 vim.current.buffer[lineno] = 'new line') neovim will remove marks on that line. Vim does not (even if the marks become invalid because the line gets shorter). The builtin setline() also does not delete marks. This can lead to incompatibilities (see https://github.com/SirVer/ultisnips/issues/1473) but could also be problem on its own, because it is not possible to recover the lost marks.

Would it be possible to adapt the behavior to match that of setline()/vim ? If not, what would be the best way to modify a line without losing marks?

bfredl commented 2 years ago

nvim_buf_set_text is preferred to change only a part of a line while preserving marks on the rest of the line.