1

Somebody told me that it is possible to write Vim plugins in Python.

I would like to inspect the source implementing this: I would like to use another scripting language for that.

Is there a documentation on how the authors implemented this Python interface to Vim?

2
  • What do you mean by "use another scripting language"? Do you mean patch Vim sources to add support for another scripting language? Which language would that be?
    – filbranden
    Jan 18, 2022 at 16:02
  • 1
    That would be Standard ML. Some theorem provers are implemented in Standard ML so building a user interface would be convenient in it.
    – Gergely
    Jan 21, 2022 at 7:44

1 Answer 1

4

The source files used for the Python integration with Vim are:

https://github.com/vim/vim/blob/master/src/if_python.c
https://github.com/vim/vim/blob/master/src/if_python3.c
https://github.com/vim/vim/blob/master/src/if_py_both.h

The Python interface is described in https://vimhelp.org/if_pyth.txt.html

Note that Vim also supports writing scripts in other languages: lua, tcl, perl, ruby and mzscheme. The source files for these interfaces are at:

https://github.com/vim/vim/blob/master/src/if_lua.c
https://github.com/vim/vim/blob/master/src/if_tcl.c
https://github.com/vim/vim/blob/master/src/if_perl.xs
https://github.com/vim/vim/blob/master/src/if_ruby.c
https://github.com/vim/vim/blob/master/src/if_mzsch.c

These interfaces are described in their respective help pages:

https://vimhelp.org/if_lua.txt.html
https://vimhelp.org/if_tcl.txt.html
https://vimhelp.org/if_perl.txt.html
https://vimhelp.org/if_ruby.txt.html
https://vimhelp.org/if_mzsch.txt.html

1
  • Thanks indeed, this was very much useful.
    – Gergely
    Jan 21, 2022 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.