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

Smart completion menu behaviour

Expand Messages
  • Paul Moore
    One really useful feature of Sublime Text is the fuzzy match behaviour of popup menus. The way this works is that if you have a menu with items begin ,
    Message 1 of 3 , Apr 4 2:44 AM
    View Source
    • 0 Attachment
      One really useful feature of Sublime Text is the "fuzzy match" behaviour of popup menus. The way this works is that if you have a menu with items "begin", "end", "eat", you start with all items showing. Then, as you type letters, the list is restricted to only those items containing the typed letters - but the letters do not have to be consecutive, or at the start of the items being completed.

      So, with the above example, type "e" and nothing changes (but the first "e" is highlighted in each item). Then type "n" and "eat" is removed from the list. Add "d" and "end" is selected.

      In effect the list is restricted to the items that match the regex .*<ch1>.*<ch2>.*<ch3>.* where ch1, ch2 and ch3 are the typed characters.

      I don't think this is currently possible in Vim. Would it be feasible to add behaviour like this to the completion menu code? (On the other hand, if it *is* possible already, can someone give me a pointer to some sample code?)

      Paul.

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • glts
      Paul, ... I think various completion plugins already do that. One instance I know of is at https://github.com/Valloric/YouCompleteMe Scroll down and you ll see
      Message 2 of 3 , Apr 4 5:10 AM
      View Source
      • 0 Attachment
        Paul,

        On Thu, Apr 4, 2013 at 11:44 AM, Paul Moore <p.f.moore@...> wrote:
        > One really useful feature of Sublime Text is the "fuzzy match" behaviour of popup menus. The way this works is that if you have a menu with items "begin", "end", "eat", you start with all items showing. Then, as you type letters, the list is restricted to only those items containing the typed letters - but the letters do not have to be consecutive, or at the start of the items being completed.
        >
        > So, with the above example, type "e" and nothing changes (but the first "e" is highlighted in each item). Then type "n" and "eat" is removed from the list. Add "d" and "end" is selected.
        >
        > In effect the list is restricted to the items that match the regex .*<ch1>.*<ch2>.*<ch3>.* where ch1, ch2 and ch3 are the typed characters.
        >
        > I don't think this is currently possible in Vim. Would it be feasible to add behaviour like this to the completion menu code? (On the other hand, if it *is* possible already, can someone give me a pointer to some sample code?)

        I think various completion plugins already do that. One instance I know
        of is at

        https://github.com/Valloric/YouCompleteMe

        Scroll down and you'll see an animated demonstration with fuzzy
        matching. Highlighting inside the popup menu isn't possible, though.

        David

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Paul Moore
        ... Ah, thanks! I d not seen anything like this, obviously my search skills weren t up to the task. As usual, Vim can do anything :-) Paul -- -- You received
        Message 3 of 3 , Apr 4 5:58 AM
        View Source
        • 0 Attachment
          On Thursday, 4 April 2013 13:10:23 UTC+1, glts wrote:
          > > I don't think this is currently possible in Vim. Would it be feasible to add behaviour like this to the completion menu code? (On the other hand, if it *is* possible already, can someone give me a pointer to some sample code?)
          >
          > I think various completion plugins already do that. One instance I know
          > of is at
          >
          > https://github.com/Valloric/YouCompleteMe
          >
          > Scroll down and you'll see an animated demonstration with fuzzy
          > matching. Highlighting inside the popup menu isn't possible, though.

          Ah, thanks! I'd not seen anything like this, obviously my search skills weren't up to the task.

          As usual, Vim can do anything :-)

          Paul

          --
          --
          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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.