How to define external Vim functions? #1041
-
Hi, I'd like to create some custom Vim functions. It looks like all the standard functions in IdeaVim are annotated with Could you please clarify it it's in fact possible to define your own functions, and if so, how? Thanks! Julien |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
If you're writing an extension to IdeaVim, you'll most likely implement Here's the method signature: ideavim/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt Lines 221 to 229 in 791edbd This essentially corresponds to the ideavim/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt Lines 278 to 280 in 791edbd This is easily implemented, takes in an editor, the current context and a map of argument to I'm only aware of one usage of this method, and that's to support custom operators from extensions with the They use the ideavim/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt Lines 257 to 276 in 791edbd It registers the script function and provides an (implicit) implementation of the |
Beta Was this translation helpful? Give feedback.
-
Thanks @citizenmatt for your thorough reply. I'll look into this and come back if I run into any issues. |
Beta Was this translation helpful? Give feedback.
If you're writing an extension to IdeaVim, you'll most likely implement
VimExtension
to register mappings, etc. You can also export functions here, using theVimExtensionFacade.exportScriptFunction
method.Here's the method signature:
ideavim/src/main/java/com/maddyhome/idea/vim/extension/VimExtensionFacade.kt
Lines 221 to 229 in 791edbd
This essentially corresponds to the
:function
command and defines the function, with name…