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

Re: Bug or feature? Mappings in omni-completion popup menu

Expand Messages
  • Bram Moolenaar
    ... In this specific case CTRL-O selects the next matching entry, like CTRL-N would. Then the g is a normal character, which stops completion and inserts it
    Message 1 of 2 , Feb 6, 2006
    • 0 Attachment
      Tony Mechelynck wrote:

      > Bug or feature? If mappings are defined for <Up> and <Down>, and these
      > keys are pressed while the omni-completion popup menu is displayed, Vim
      > uses the corresponding {rhs} instead of moving the selection up or down.
      >
      > Example: in an HTML file
      >
      > The following mappings are active
      >
      > :map <Up> gk
      > :map <Down> gj
      > :imap <Up> <C-O>gk
      > :imap <Down> <C-O>gj
      >
      > 'wrap' is on (hence the above mappings)
      > 'completeopt' is at its default value, "menu".
      >
      > Insert in an HTML file the line
      >
      > <A |
      >
      > (where | is the insert cursor), then hit Ctrl-X Ctrl-O
      >
      > A popup menu appears. The first menu item, accesskey=" , is selected.
      > Now hit <Down> : the menu disappears and the line is "completed" as
      >
      > <A accesskey="gj|
      >
      > (where | is the new location of the insert cursor).
      >
      > Bug or feature? (Workaround: use Ctrl-N instead of <Down>, Ctrl-P
      > instead of <Up>)
      >
      > Cf. ":help ins-completion-menu"

      In this specific case CTRL-O selects the next matching entry, like
      CTRL-N would. Then the "g" is a normal character, which stops
      completion and inserts it literally. This is the expected behavior.

      There was a request for a specific kind of mapping for completion, or
      just when the popup menu is used. The problem is that this would
      disable all Insert mode mappings. Currently they would work as before.
      Thus if you have a mapping to insert some text you would first have to
      stop completion before it works.

      On the other hand, it's to be expected that many Insert mode mappings
      start with CTRL-O, thus won't work during omni completion anyway.

      If different mappings are used, we also need to decide if this is when
      any completion is active, or only when the popup menu is being used.

      So many choices...

      --
      Women are probably the main cause of free software starvation.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://www.ICCF.nl ///
    Your message has been successfully submitted and would be delivered to recipients shortly.