Skip to content

Epic: Support dictionary/data lookup in MacVim #1311

Open

Description

@ychin

It is useful to support the ability to look up a piece of selected / highlighted text in MacVim and show a OS popup that gives you more information. #1191 was the original issue, but this work has ballooned as this becomes more ambitious and need to span multiple commits. Using this epic to track the work and elicit ideas / brainstorm.

  • Support dictionary/data lookups of text #1312
    • Basic implementation to support looking up text in the Core Text view:
  • Support looking up selected texts, and also add data detector for URLs etc #1313
    • Data detection. Should detect URLs, addresses, etc, using NSDataDetector. Note that WebKit/NSTextView use an internal "Reveal" API, which we don't have access to as a third-party software, so we will not be able to do as good as job as them, especially for things like package tracking and airline numbers.
    • Looking up selected texts (when in visual mode) should look up the whole text, not just the individual words.
  • Add Vim script support and a popup menu for data lookup #1315
    • Vimscript API support to look up arbitrary data. Add a new function showdefinition() so that we can programmatically invoke this.
    • Right click menu should show a "Look Up" item. This makes it easier to trigger the look up without need a trackpad as Ctrl-Cmd-D is a little unwieldy and harder to discover.
  • Others
    • Autocmd to intercept lookups and override what to do (see custom popup as an example)
    • Custom popup. This would allow us to popup arbitrary dialog boxes with Markdown / HTML support using NSPopUp. E.g. show documentation in richer format.
      • Extend balloon to support using this. Right now balloon is too barebone and text only
    • Add documentation to a new doc folder for technical details and general guidelines. Would be a nice time to update the src/MacVim/README file which hasn't been updated forever.

Activity

  1. eirnym commented on Oct 14, 2022

    @eirnym
    Contributor

    I wonder if there will be an option to disable this feature. It would be even better if I can control what to disable. e.g. if I'd like to disable macOS dictionary lookups leaving URL recognition.

  2. ychin commented on Oct 14, 2022

    @ychin
    MemberAuthor

    Why would you need to disable it? This only triggers per user interaction. If you don’t like the built in dictionary you can just not trigger the lookup which is quite hard to accidentally do.

  3. eirnym commented on Oct 14, 2022

    @eirnym
    Contributor

    Yep, I don't want to trigger is dictionary lookup. Dictionary for Polish, primary language I use beside English during writing a code is so poor and I there's no way to install a custom one, so I don't use this feature in macOS at all as it's completely useless.

    Additionally, I like MacVim to be a editor with lightweight OS integration when I don't need it. Also I like Vim itself for an ability to customise it.

    As a possible solution I propose make operations noop. I agree, that custom integration is a good thing, but not the macOS dictionary.

  4. ychin commented on Oct 14, 2022

    @ychin
    MemberAuthor

    I still don’t understand under what circumstance would this be an issue for you? Can you be more specific? I’m not asking why you don’t like the built in dictionary (note that this allows looking up other data like general knowledge articles, not just definitions of words). I'm asking why we would need an option to turn this off.

    Only known ways I know to trigger this:

    • Ctrl-Cmd-D: this is super specific and I doubt something people accidentally trigger too much. It’s OS-wide so if you dislike the dictionary so much I would imagine you would have avoided this keystroke a long time ago
    • Trackpad: either force click or three finger taps, both of which are not easy to misfire and the OS already allows you to turn it off system-wide.

    I just don’t understand why you would care if you never use this feature. Most macOS applications support this so this is a pretty basic OS integration. I think options make sense when there is a reason for them but not when the feature is completely opt in to begin with.

  5. added
    EpicLarge tasks to be split up into smaller chunks
    on Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EpicLarge tasks to be split up into smaller chunks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions