0

Vim has this nice built-in feature where it marks the last edited line with the '.' mark, so jumping to the '.' always goes to that line. But after invoking the equalprg, the '.' mark is always moved to the first line in the file, since equalprg makes a modification to every line (even lines where no characters were changed by equalprg). Is there a configuration trick to suspend automatic positioning of the '.' mark during this kind of automatic buffer modification?

Note that the viewport and cursor position are preserved over the equalprg invocation this way:

noremap <C-f> :let v = winsaveview()<CR> gg=G :call winrestview(v)<CR> 
6
  • Not sure, but does using g; help you jump where you wanted?
    – D. Ben Knoble
    Apr 7 at 23:11
  • Do you actually explicitly use the . mark, as in '., or are you annoyed by the current behavior, as in "I'd rather keep the cursor in place after gq and not have an extra jump added"?
    – romainl
    Apr 8 at 6:18
  • @D.BenKnoble g; does not retain the last edit position separately from other cursor positions. Apr 8 at 13:56
  • @romainl I'm using the '. command. My trigger for the formatprg does retain both the viewport and the cursor position. Only the . mark position itself is getting discarded. Apr 8 at 13:59
  • If you have a wrapper around gq, then it might be a good idea to include it to your question.
    – romainl
    Apr 8 at 14:30

0

Your Answer

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

Browse other questions tagged or ask your own question.