Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Vim script support and a popup menu for data lookup #1315

Commits on Oct 15, 2022

  1. Add Vim script support and a popup menu for data lookup

    Add a new Vim script function `showdefinition()` that allows Vim script
    to call back to macOS's data lookup feature and show the definition /
    URL preview / etc for any text, at a designated row/col position. If the
    row/col are not provided this function will just show it at the cursor.
    
    Also, add a new autoload/macvim.vim for utility functions to call
    showdefinition() for selected texts and the word under cursor. Make a
    new right-click popup menu "Look Up" call that when there are selected
    texts in visual mode to make the lookup functionality easier to access
    for users without a trackpad (since Ctrl-Cmd-D is a little obscure and
    unwieldy to use). For the utility functions, it was a little hard to
    determine how to get the text under visual selection without yanking (we
    don't want to pollute the register here), and just implemented a
    function to take care of all the edge cases including visual/block/line
    modes and selection=exclusive. It could be useful in other situations.
    
    As a side refactor, change the message handler in MacVim from if/else to
    switch case. In optimized builds, they both essentially optimize to the
    same thing, but for debug builds, the if/else statements have to step
    through one by one, and switch case just makes more sense for a giant
    message ID lookup like this.
    
    Part of Epic macvim-dev#1311
    ychin committed Oct 15, 2022
    Configuration menu
    Copy the full SHA
    d8a4dcb View commit details
    Browse the repository at this point in the history