macvim
macvim copied to clipboard
Epic: Support dictionary/data lookup in MacVim
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.
- #1312
- [x] Basic implementation to support looking up text in the Core Text view:
- #1313
- [x] 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.
- [x] Looking up selected texts (when in visual mode) should look up the whole text, not just the individual words.
- #1315
- [x] Vimscript API support to look up arbitrary data. Add a new function
showdefinition()so that we can programmatically invoke this. - [x] 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.
- [x] Vimscript API support to look up arbitrary data. Add a new function
- 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
docfolder for technical details and general guidelines. Would be a nice time to update thesrc/MacVim/READMEfile which hasn't been updated forever.
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.
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.
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.
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.