-- Leo's gemini proxy

-- Connecting to bbs.geminispace.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; charset=utf-8

What is the best way to write a plugin in Lua and C?


I wrote a plugin to use Vim as a hex editor. As there is quite a bit of computation to do I prefered not to do them in Vimscript. As the hex editor will manipulate arbitrary data and not text, Lua seemed a better choice than Python as the strings don't need to contain only Unicode characters. As some functions do heavy computation, I wrote them in C for the very substantial speed boost.


https://github.com/Arkaeriit/vim-hex


Unfortunately, compiling the C librairy is not trivial. You need the Lua dev library installed, and the must be the same version as the one embedded in Vim. I had to download Lua 5.2 for that purpose. The solution I went with is having the heavy funtion writen both in C and in Lua and fallback to the Lua one if the C lib is not compiled.


But I would like the fast option to be easy to install for anyone. One option would be to automatically get the Lua verison embedded in Vim and download it during compilation. Does anyone knows how I could get that version from a shell script?


Posted in: s/vim

🐦 Arkaeriit

2023-07-02 · 11 months ago


3 Comments ↓


🚀 stack [mod] · 2023-07-02 at 00:46:

— https://vi.stackexchange.com/questions/35176/how-to-get-the-lua-version-of-neovim

I know its neovim, but at least something...


🐦 Arkaeriit [OP] · 2023-07-02 at 09:37:

@stack Thanks a lot. This works in normal Vim as well. Unlike Lua's builtin _VERSION, this also shows the patch level which is exactly what we I need to download a Lua version.


🐦 Arkaeriit [OP] · 2023-07-02 at 10:07:

I managed to make it work. Thanks again @stack.

-- Response ended

-- Page fetched on Sun May 19 11:24:04 2024