Loading ...
Sorry, an error occurred while loading the content.

13326Re: wish for `` in vim

Expand Messages
  • Bram Moolenaar
    Feb 9, 2000
    • 0 Attachment
      Gabriel Zachmann wrote:

      > I would like to ask for a slight modification of what `` does in vim.
      > Right now, it jumps back to the former position,
      > and it places the new current line usually in the center of the window.
      > However, I think it would make sense to place the new current line
      > at the same position within the window where it was before.

      You mean that the relative position of the cursor line in the window is
      remembered for the mark? Since the mark may have been set by a command that
      didn't scroll the window, it would be strange if `` does scroll the window.

      Also, when `` jumps to a position which is already being displayed, it's
      strange that the text will scroll.

      > Reason:
      > I've got a little autocommand for HTML files,
      > which jumps to the end of the file when saving it,
      > inserts the current date,
      > then jumps back (while vim saves the file).
      > It works fine, except that after I've done :w
      > the current line is somewhere else on the screen than before,
      > which is a little bit irritating.
      > I think this problem can be generalized: `` can be used often quite
      > conveniently in some autocommand to jump back to the position where the
      > cursor was before the autocommand was invoked.
      > The idea is to hide from the user that an autocommand has been invoked.
      > In order to not disturb the user, it would be nice if `` would also
      > restore the position on the screen, not only the position in the file.

      That can be fixed in another way, without changing the meaning of ``:

      save position: maHmb
      restore position: 'bzt`a

      > PS:
      > Of course, I am pretty sure that this could also be solved by a vim
      > script -- but in this case it seems to me that the right place to solve
      > it would be the `` command itself, because it would make things a
      > little bit more consistent, IMHO.

      But it would make `` incompatible with Vi and previous releases of Vim. Since
      there is another solution, I prefer to keep `` compatible.

      The Characters and incidents portrayed and the names used are fictitious and
      any similarity to the names, characters, or history of any person is entirely
      accidental and unintentional.
      Signed RICHARD M. NIXON
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
      \ \ Vim: http://www.vim.org ICCF Holland: http://www.vim.org/iccf / /
    • Show all 3 messages in this topic