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

81315Re: Abbreviations beginning with non-keyword character

Expand Messages
  • Tony Mechelynck
    Aug 1, 2007
    • 0 Attachment
      Jonas wrote:
      > Hi there
      > I wonder if there is really no way to make abbreviations beginning
      > with non-keyword characters.
      > Specifically I want to abbreviate LateX commands, so I require them to
      > begin with a \ (the abbreviations are still LateX commands in my
      > mind).
      > Using mapping is inefficient for two reasons: I cannot see what I type
      > in the body of the text, and the mapping is triggered as soon as it is
      > finished, so that it's very cumbersome to type a non-mapped command
      > with the same beginning as a mapped one.
      > Thanks for the help.
      > Jonas

      Abbreviations may begin with a non-id character, but there are more constraints:

      - An "end-id" abbreviation consists of non-keyword characters followed by
      exactly one keyword character. It must be preceded by a keyword character, a
      whitespace character, or be at the start of the line or of the insertion.

      - A "non-id" abbreviation consists only of non-keyword characters. It must be
      preceded by whitespace, or be at the start of the line or of the insertion.

      - Any abbreviation whatsoever must be followed by a non-keyword character, or
      by the <Ctrl-]> which triggers expansion, the <Esc> which ends insertion or
      the <Enter> which ends an ex-command.

      What you can do is map the \ key to start a function which would get keyboard
      input, process it, and finally return a string to be inserted into the buffer.
      The partial sequence would probably not appear in the file window though. It
      might be possible (I'm not sure, I haven't pushed the idea to its end) to have
      it appear at the bottom, on the command/status line. I think Dr.Chip is more
      expert than I am about "crazy" mappings.

      Best regards,
      Fresco's Discovery:
      If you knew what you were doing you'd probably be bored.

      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 4 messages in this topic