Save/restore cursor location upon fold close/open
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.
I assume I could remap zc
and za
to create a mark at the current cursor position as a sort of PreFoldClose
hook, and then I could remap zo
and za
to move the cursor to said mark as a sort of PostFoldOpen
hook.
But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?
Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview
command?
vim
add a comment |Â
up vote
0
down vote
favorite
When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.
I assume I could remap zc
and za
to create a mark at the current cursor position as a sort of PreFoldClose
hook, and then I could remap zo
and za
to move the cursor to said mark as a sort of PostFoldOpen
hook.
But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?
Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview
command?
vim
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.
I assume I could remap zc
and za
to create a mark at the current cursor position as a sort of PreFoldClose
hook, and then I could remap zo
and za
to move the cursor to said mark as a sort of PostFoldOpen
hook.
But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?
Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview
command?
vim
When I open a fold, either one created manually or one created automatically based off syntax, my cursor remains on the top line of the fold. Instead, I'd like it to jump to the position it was at within the fold before the fold had been closed.
I assume I could remap zc
and za
to create a mark at the current cursor position as a sort of PreFoldClose
hook, and then I could remap zo
and za
to move the cursor to said mark as a sort of PostFoldOpen
hook.
But I am hoping there might even be an option that simply turns this feature on for me. What do y'all think?
Bonus: how do you persist file marks across buffer loads/unloads? Are marks included by the mkview
command?
vim
vim
asked 7 mins ago
courtyardz
133
133
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475486%2fsave-restore-cursor-location-upon-fold-close-open%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password