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

Vimscript - how to make menu/selection similar to `z=` and `g `

Expand Messages
  • Bruno Sutic
    Hello fellow Vim users! I began learning vim script from the most excellent resource: http://learnvimscriptthehardway.stevelosh.com/ I noticed 2 things vim
    Message 1 of 2 , Oct 21, 2013
    • 0 Attachment
      Hello fellow Vim users!
      I began learning vim script from the most excellent resource: http://learnvimscriptthehardway.stevelosh.com/

      I noticed 2 things "vim can do", but I don't know how to re-use for my scripts:

      1. when the cursor is on a spelling error, you can press `z=` to get a list of possible corrections. Is there a way I can get that behavior and use it for other things?
      Naturally, I wouldn't use that for spell correction - but for let's say a choosing an option from a long list.

      2. when using ctags with vim, you can press g<Ctrl-]> to get a (colored) "menu" with a list of matching tags and a prompt to jump to selected tag (just a note - the menu and prompt is shown only if there's more matches for the current tag).
      Now, the same as above - is there a way to get this exact menu/prompt for other scripts and other uses?

      I couldn't find anything useful on google for this - I think I don't know the right terms.
      But a pointer to a help section or a related link would be most useful!

      Thanks

      --
      --
      You received this message from the "vim_use" 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_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • glts
      ... You can, and many plugins already do. Though it works in insert mode ... You can use inputlist(), but probably not with colours. ... Check out :h
      Message 2 of 2 , Oct 21, 2013
      • 0 Attachment
        On Monday, October 21, 2013 3:23:27 PM UTC+2, Bruno Sutic wrote:
        > I began learning vim script from the most excellent resource: http://learnvimscriptthehardway.stevelosh.com/
        >
        > I noticed 2 things "vim can do", but I don't know how to re-use for my scripts:
        >
        > 1. when the cursor is on a spelling error, you can press `z=` to get a list of possible corrections. Is there a way I can get that behavior and use it for other things?
        > Naturally, I wouldn't use that for spell correction - but for let's say a choosing an option from a long list.

        You can, and many plugins already do. Though it works in insert mode
        (like CTRL-X CTRL-S). The documentation has a full example. It's at:

        :h complete-functions

        > 2. when using ctags with vim, you can press g<Ctrl-]> to get a (colored) "menu" with a list of matching tags and a prompt to jump to selected tag (just a note - the menu and prompt is shown only if there's more matches for the current tag).
        > Now, the same as above - is there a way to get this exact menu/prompt for other scripts and other uses?

        You can use inputlist(), but probably not with colours.

        :h inputlist()

        Check out ":h function-list", too, maybe there's something more to your
        liking.

        Best,

        --
        --
        You received this message from the "vim_use" 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_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+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.