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

Documentation bug (not very important)

Expand Messages
  • Tony Mechelynck
    In eval.txt, under getcmdpos() and getcmdtype(), IMHO it should be mentioned that they also work in the {rhs} of a :cmap or :cabbrev (and friends) with the
    Message 1 of 2 , Apr 1, 2012
    • 0 Attachment
      In eval.txt, under getcmdpos() and getcmdtype(), IMHO it should be
      mentioned that they also work in the {rhs} of a :cmap or :cabbrev (and
      friends) with the <expr> modifier (which is only available in Vim 7 and
      later).

      Example (which works for me, I have it in my vimrc; it assumes
      'nocompatible'):

      " open help window at bottom if :help was shortened to :h
      if version < 700
      cnoreabbrev h bot h
      else
      cnoreabbrev <expr> h
      \ ((getcmdtype() == ':' && getcmdpos() <= 2)? 'bot h' : 'h')
      endif



      Best regards,
      Tony.
      --
      ZOOT: I'm afraid our life must seem very dull and quiet compared to yours.
      We are but eightscore young blondes, all between sixteen and
      nineteen-and-a-half, cut off in this castle, with no one to
      protect us.
      Oooh. It is a lonely life ... bathing ... dressing ...
      undressing ...
      making exciting underwear....
      "Monty Python and the Holy Grail" PYTHON (MONTY)
      PICTURES LTD

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Bram Moolenaar
      ... OK: Only works when editing the command line, thus requires use of ... -- Life would be so much easier if we could just look at the source code. /// Bram
      Message 2 of 2 , Apr 1, 2012
      • 0 Attachment
        Tony Mechelynck wrote:

        > In eval.txt, under getcmdpos() and getcmdtype(), IMHO it should be
        > mentioned that they also work in the {rhs} of a :cmap or :cabbrev (and
        > friends) with the <expr> modifier (which is only available in Vim 7 and
        > later).
        >
        > Example (which works for me, I have it in my vimrc; it assumes
        > 'nocompatible'):
        >
        > " open help window at bottom if :help was shortened to :h
        > if version < 700
        > cnoreabbrev h bot h
        > else
        > cnoreabbrev <expr> h
        > \ ((getcmdtype() == ':' && getcmdpos() <= 2)? 'bot h' : 'h')
        > endif

        OK:

        Only works when editing the command line, thus requires use of
        |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.

        --
        Life would be so much easier if we could just look at the source code.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.