← Back to context

Comment by segmondy

10 years ago

vim, supports multiple yanks in it's registers, and so does emac.

This is the real equivalent. I don't know vim (I assume it's similar), but emacs can put killed text AND buffer locations (and a lot of other things) into registers. To me, this is a mark of advanced Emacs usage -- familiarity and comfort with registers.

  • Yup, you can put buffer locations in registers in Vim, but they're in a separate "namespace" from the yank registers. They're normally called "marks" (as in bookmarks) in Vim parlance.

        "[a-zA-Z0-9\-"][ypd]{,2}       -- Quote to specify a register,
                                          followed by an alphanumeric
                                          character (or hyphen, or double
                                          quote (the default register))
                                          followed by a yank, put, or
                                          delete command.
        m[a-zA-Z\[\]<>]                -- Set the mark indicated by the
                                          following character.  Lower-case
                                          characters are buffer-local,
                                          upper-case are global across
                                          all buffers in the session.
                                          [, ], <, and > are normally
                                          implicit marks: [] refer to
                                          the start and end of the last
                                          effected range of text, while <>
                                          refer to the start and end of
                                          the visual selection (if any).
        '[a-zA-Z0-9<>'`"^\.(){}]       -- Jump to the mark indicated by
                                          the following character. Numeric
                                          marks are set in the .viminfo
                                          file, while the special
                                          characters refer to various
                                          implicit marks, which I won't
                                          list here since there's so many.
    

    As in Emacs, I tend to think of it as a mark of advanced usage (but one among many, really). Navigating around in Vim is exquisite once you grok using marks. Vi had registers and marks as well, but marks were limited to buffer-local only, if I recall correctly.

    This reminds me -- I need to get back into Emacs and learn some more! Hopefully this time I don't get carried away writing Lisp all night again ;) Makes me yearn for a Vim that's configurable and extensible with Lisp (there's a plugin that enables writing extensions in Racket, but I'm not sure how much extensibility it actually affords compared to Vimscript -- my guess is that it's probably rather limited, I'm afraid).