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?

Gergely
  • 293
  • 2
  • 6
  • 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 '22 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 '22 at 07:44

1 Answers1

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