Neovim and Sundry

Neovim logo

[1]

What is Neovim

Neovim is the new vim! (Okay, not exactly but sort of?). It's vim, but specialized for more modern systems and not as dependent on maintaining compatibility. It's also ehanced with lua scripting, lsp integration, and treesitter integration.

or, as the website oh so helpfully calls is: "hyperextensible Vim-based text editor"

LuaJit with arm64 and Debian

Debian ships a version of neovim for the arm64 platform. This, you might say, is great! And it is, so long as you don't need to use any of the luajit integration points, either of your editor or of your plugins. Let's fix this. I'll show you the easy (and best!) way first, then the hard way.

dpkg --add-architecture armhf
apt-get install neovim:armhf

Yup. That's all that you really need to do. It's all I should have done. But, I didn't, and we'll be going into what I've done next. First, things that didn't work quite so well...

  • flatpak: it doesn't have access to your path and all your lovely lsp servers
  • appimage: it's built for an x86_64 machine (nvim is trying to support
    the future, but I happen to think the future is arm and not amd64)
  • building from source directly: it'll work just fine, but it'll be a bear to maintain in the long run.

So, what should I do? Build myself a deb package with luajit instead of base lua. We'll start by installing pbuilder and creating an environment.

apt-get install pbuilder
pbuilder create

Then, we'll download the source code for the debian package, as well as its build dependencies.

apt-get build-dep neovim
apt-get source neovim

and update the build files for arm64's compiler and the use of luajit (one test ails on ARM architectures, so patch that out too. ideally, I'd fix it but it also fails on armhf, so I'm not going to spend too much time digging today)

--- debian/control.old      2022-09-01 17:06:48.797215829 -0400
+++ debian/control  2022-09-01 17:05:48.843040845 -0400
@@ -11,7 +11,7 @@
  less <!nocheck>,
  libacl1-dev,
  libkvm-dev [kfreebsd-any],
- libluajit-5.1-dev [amd64 armel armhf hurd-i386 i386] | liblua5.1-dev,
+ libluajit-5.1-dev [amd64 arm64 armel armhf hurd-i386 i386] | liblua5.1-dev,
  libmsgpack-dev (>= 1.0.0),
  libnss-wrapper <!nocheck>,
  libtermkey-dev,
@@ -27,7 +27,7 @@
  lua-lpeg,
  lua-luv-dev (>= 1.43.0),
  lua-nvim (>= 0.0.1-26-1~) [!hurd-i386] <!nocheck>,
- luajit [amd64 armel armhf hurd-i386 i386],
+ luajit [amd64 arm64 armel armhf hurd-i386 i386],
  lua5.1,
  ninja-build,
  pkg-config,

--- a/debian/rules
+++ b/debian/rules
@@ -37,6 +37,9 @@ FUNCTEST_FILTER_OUT=
 ifneq (,$(filter armhf,$(DEB_HOST_ARCH)))
   FUNCTEST_FILTER_OUT='memory usage releases memory when closing windows when folds exist'
 endif
+ifneq (,$(filter arm64,$(DEB_HOST_ARCH)))
+  FUNCTEST_FILTER_OUT='memory usage releases memory when closing windows when folds exist'
+endif

 export USERNAME = team+vim
 export HOSTNAME = tracker.debian.org

--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -135,6 +135,8 @@ local function filter_complex_blocks(body)
     if not (string.find(line, "(^)", 1, true) ~= nil
             or string.find(line, "_ISwupper", 1, true)
             or string.find(line, "_Float")
+            or string.find(line, "_Float128")
+            or string.find(line, "__uint128")
             or string.find(line, "msgpack_zone_push_finalizer")
             or string.find(line, "msgpack_unpacker_reserve_buffer")
             or string.find(line, "UUID_NULL")  -- static const uuid_t UUID_NULL = {...}

and finally, build

pdebuild
dpkg -i /var/cache/pbuilder/result/neovim_0.7.2-3_arm64.deb
dpkg -i /var/cache/pbuilder/result/neovim-runtime_0.7.2-3_all.deb

top

[1]logo released under CC-BY-3.0 by Jason Long