Adding Vim 9 and Neovim
Hi! Trust you are doing okay?
I've been using Vim on a-shell for the past two weeks and I wonder if it's possible to get it to version 9 or to get neovim running, if possible?
I will be glad to follow any tutorials to compile it myself if there is.
Thank you.
The good news is: I regularly update the commands in a-Shell, so vim is slated for an update at some point (probably October) and neovim is also going to come as well. The bad news: because I regularly update the commands in a-Shell, I'm currently in the middle of upgrading Python to 3.13, which is a tall order. New commands, like neovim, will have to wait until after this upgrade.
I welcome you proposition of help with neovim. You will need a Mac, running OSX, with Xcode installed.
- install a-Shell itself (
git submodule update --init --recursive, then download all the xcFrameworks withdownloadFrameworks.sh) - compile, using the a-Shell-noPython target (distributing Python as binaries is just too difficult for now)
- clone the neovim directory, and also the Vim-for-a-Shell directory (https://github.com/holzschu/vim). That one is used as an example of how to edit or adapt things.
- cross-compile neovim for arm64 and iOS. Have a look inside
build_vim_xcframework.sh:
./configure \
vim_cv_toupper_broken=no \
vim_cv_terminfo=no \
vim_cv_tgetent=zero \
vim_cv_memmove_handles_overlap=no \
vim_cv_memcpy_handles_overlap=no \
vim_cv_bcopy_handles_overlap=no \
vim_cv_tty_group=world \
vim_cv_stat_ignores_slash=yes \
vim_cv_getcwd_broken=no \
LUA_PREFIX=${PWD} \
vi_cv_path_plain_lua=/usr/bin/lua \
vi_cv_version_plain_lua=5.4.4 \
--with-tlib=ncurses \
--with-features=big \
--enable-luainterp \
--enable-python3interp \
--with-python3-command=python3 \
CC=clang \
CXX=clang++ \
CFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -fembed-bitcode -DDYNAMIC_PYTHON3" \
CPPFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -DDYNAMIC_PYTHON3" \
CXXFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -fembed-bitcode -DDYNAMIC_PYTHON3" \
LDFLAGS="-shared -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -F$FRAMEWORKS -framework ios_system " \
--build=x86_64-apple-darwin --host=armv7-apple-darwin
You will need to adapt this for neovim. The first lines (vim_cv_...) are vim configuration options. For example we cannot use terminfo and tgetent, so we disable them. The last lines define which compiler to use, and which flags to pass to it in order to create an Arm64 iOS binary (-arch arm64 -miphoneos-version-min=14.0). And at the very last line we tell configure that we are cross-compiling for the architecture armv7-apple-darwin, on a computer running x86_64-apple-darwin (that's my computer. If you have one of the modern M1/M2/M3 Macs, it should be replaced with arm64-apple-darwin, I think).
Once you've run configure and make (or whatever build system neovim uses), you should have a file named vim which is actually an dynamic library for iOS:
% file src/vim
src/vim: Mach-O 64-bit arm64 dynamically linked shared library, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|NO_REEXPORTED_DYLIBS|HAS_TLV_DESCRIPTORS>
The rest of the script creates an XcFramework, vim.xcframework, which is then copied into the a-Shell frameworks directory (a-Shell/xcfs/.build/artefacts/vim/). Since you're working with neovim, it's a new framework, which you have to embed into the a-Shell-noPython project (see "Embed frameworks", under "Build Phases"), and you also have to add the new command in Resources_mini/commandDictionary.plist: just copy-past the vim entry and replace vim with neovim.
Remember, cross-compiling is hard, it doesn't always work. But any efforts you can put into this will help in making neovim run in a-Shell.
Thank you for your response. I would have love to try this except I don't own a Mac.
I'll wait till October for this update.
I welcome you proposition of help with neovim. You will need a Mac, running OSX, with Xcode installed.
Hello, I am interested in helping with neovim. I'm wondering if there has been any progress made since then. When I have some spare time I will dig out my old MacBook Pro and try to follow your instructions from above. (I don't reckon that I can use Xcode on Linux)