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
The autoload directory is for standard Vim autoload scripts. These are functions used by plugins and for general use. They will be loaded automatically when the function is invoked. See ":help autoload". gzip.vim for editing compressed files netrw*.vim browsing (remote) directories and editing remote files tar.vim browsing tar files zip.vim browsing zip files paste.vim common code for mswin.vim, menu.vim and macmap.vim spellfile.vim downloading of a missing spell file Omni completion files: ccomplete.vim C csscomplete.vim HTML / CSS htmlcomplete.vim HTML javascriptcomplete.vim Javascript phpcomplete.vim PHP pythoncomplete.vim Python rubycomplete.vim Ruby syntaxcomplete.vim from syntax highlighting xmlcomplete.vim XML (uses files in the xml directory)