mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-02-14 11:53:26 +01:00
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 #1311
This folder contains MacVim-specific menu translations. While Vim already has menu translations, MacVim has some unique menu items and some Vim menu items are renamed to fit Apple's HIG better. As such, they need to be translated as well. Note that not 100% of the menu items in all locales are all translated right now, but the majority of them should be covered.
Each locale has up to two translation files that will be sourced into the main menu translation file for that locale:
- .apple.vim: This contains official Apple translations for common menu items such as "New Window" and "Font". They were auto-generated by using a script (
src/MacVim/scripts/extract-specific-localised-strings.swift) to extracts official translations from Apple Developer's glossaries (https://developer.apple.com/download/more/?=glossaries). - .custom.vim: This contains custom translations that don't have easy official translations to look up and have to be manually translated.