Closed Naitreey closed 6 years ago
@anntzer is probably the best person to weigh in on this. Hopefully he will see this and say if it works alright.
Either way we can do something to ensure that it doesn't break anything.
I am a bit confused why the position of the [ mark would change, the docs say
*'[* *`[*
'[ `[ To the first character of the previously changed
or yanked text. {not in Vi}
but no text is being changed or yanked...
I also wonder whether you can save the mark positions more easily with :lockmarks or :keepmarks (dunno).
@anntzer Well, I actually tried prepending lockmarks
or keepmarks
before keeppatterns
but neither could have stopped [
...
By the way, I'm using Vim 8.1:
$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 13 2018 14:59:01)
Included patches: 1-279
Compiled by Arch Linux
Huge version with GTK3 GUI.
# .....
You're probably using the latest version, I sent the most recent snapshot to Bram earlier this month.
See the doc of getpos()
:
This can be used to save and restore the position of a mark: >
let save_a_mark = getpos("'a")
...
call setpos("'a", save_a_mark)
Seems simpler than redir?
OK, that's much better... :+1:
In
RstFold.vim
, folding data is generated byAfter which the
[
mark is modified to be at the line of the first title.However the
[
mark is used by vim-unimpaired for restoring cursor position after inserting a new blank line (See line 189, I've pasted relevant lines below):I'm not sure what's the correct solution for this (VimL newbie here). But anyway, I've proposed a fix that restores
[
mark after%s
:If this is the way to go, I'll be happy to send a PR.