Curly When using curly braces navigation, {, }, to move between paragraph, overwrites the "last jump" mark (the one accessible via ''). I would find it more useful if it left this mark untouched. Is there any way to configure vim like this?
1 Answer
You can use the keepjumps command. From :h :keepjumps:
*:keepj* *:keepjumps*
:keepj[umps] {command}
Moving around in {command} does not change the |''|,
|'.| and |'^| marks, the |jumplist| or the
|changelist|.
Useful when making a change or inserting text
automatically and the user doesn't want to go to this
position.
So in your case, you'd want
nnoremap } :keepjumps normal! }<cr>
nnoremap { :keepjumps normal! {<cr>
Or, if you want it to work for visual mode too (which your probably do):
xnoremap } :<C-u>keepjumps normal! gv}<cr>
xnoremap { :<C-u>keepjumps normal! gv{<cr>
-
Hmm. Looks promising, but this gives the error "E169: Command to recursive" when I press
{or}.nijoakim– nijoakim2017-04-11 08:19:52 +00:00Commented Apr 11, 2017 at 8:19 -
@nijoakim Did you do
nmapornnoremap? That shouldn't be an issue as long as you donnoremap.DJMcMayhem– DJMcMayhem2017-04-11 14:06:17 +00:00Commented Apr 11, 2017 at 14:06 -
@DJMacMayhem: I tried them both. I also copied the text exactly as you wrote it. Can you confirm it works for you?nijoakim– nijoakim2017-04-12 07:15:57 +00:00Commented Apr 12, 2017 at 7:15
-
@nijoakim Oh, I see what the issue is now. See my edit. Does that work for you?DJMcMayhem– DJMcMayhem2017-04-12 07:19:24 +00:00Commented Apr 12, 2017 at 7:19