Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/neovim-nightly/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="Apache-2.0, VIM License"
TERMUX_PKG_LICENSE_FILE="LICENSE.txt"
TERMUX_PKG_MAINTAINER="Joshua Kahn <tom@termux.dev>"
TERMUX_PKG_VERSION="0.12.0~dev-2508+g61f166ec40"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL="https://github.com/neovim/neovim/archive/${TERMUX_PKG_VERSION##*+g}.tar.gz"
TERMUX_PKG_SHA256=3daa4f0f14577517d37a4e9c825bcdbe87645ff708971a1c5ded042e14d28a78
TERMUX_PKG_REPOLOGY_METADATA_VERSION="${TERMUX_PKG_VERSION%%~*}"
Expand Down
1 change: 1 addition & 0 deletions packages/neovim-nightly/has-termux.patch
1 change: 0 additions & 1 deletion packages/neovim-nightly/src-nvim-eval-funcs.c.patch

This file was deleted.

2 changes: 1 addition & 1 deletion packages/neovim/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TERMUX_PKG_LICENSE="Apache-2.0, VIM License"
TERMUX_PKG_LICENSE_FILE="LICENSE.txt"
TERMUX_PKG_MAINTAINER="Joshua Kahn <tom@termux.dev>"
TERMUX_PKG_VERSION="0.11.6"
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL="https://github.com/neovim/neovim/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz"
TERMUX_PKG_SHA256=d1c8e3f484ed1e231fd5f48f53b7345b628e52263d5eef489bb8b73ca8d90fca
TERMUX_PKG_DEPENDS="libandroid-support, libiconv, libmsgpack, libunibilium, libuv, libvterm (>= 1:0.3-0), lua51-lpeg, luajit, luv, tree-sitter, tree-sitter-parsers, utf8proc"
Expand Down
56 changes: 56 additions & 0 deletions packages/neovim/has-termux.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
The first two hunks of patch are applied directly to the pregenerated documentation files.
This means it must be (re)created from the release tarballs if it needs to be regenerated!

Modifying `src/nvim/eval.lua` and then recreating the documentation files with `make doc`
would in principle be possible as part of the `termux_step_host_build()` function.
However as of time of writing, March 6. 2026 (Neovim version 0.11.6) I have not been able
to successfully produce modified docs for Neovim at build time.

Please make sure to retain this header comment if you regenerating this patch.
diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt
index 8f52e14..7c35094 100644
--- a/runtime/doc/vimfn.txt
+++ b/runtime/doc/vimfn.txt
@@ -4624,6 +4624,10 @@ has({feature}) *has()*
win32 Windows system (32 or 64 bit).
win64 Windows system (64 bit).
wsl WSL (Windows Subsystem for Linux) system.
+ android Alias for has('termux')
+ termux Termux environment (The *termux* and *android*
+ feature flags are {included additionally}
+ in Termux's Neovim package.)

*has-patch*
3. Vim patch. For example the "patch123" feature means that
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index 1a13885..491a48b 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -4175,6 +4175,10 @@ function vim.fn.globpath(path, expr, nosuf, list, allinks) end
--- win32 Windows system (32 or 64 bit).
--- win64 Windows system (64 bit).
--- wsl WSL (Windows Subsystem for Linux) system.
+--- android Alias for has('termux')
+--- termux Termux environment (The *termux* and *android*
Comment on lines +33 to +34
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an objection, just curious: does vim.uv.os_uname() return enough info to achieve this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's gonna be terribly useful unfortunately.

-- package version: neovim 0.11.6-2
-- nvim --clean
{
  machine = "aarch64",
  release = "5.4.274-qgki-g6ef38bd89f5c",
  sysname = "Linux",
  version = "#1 SMP PREEMPT Wed Jan 28 16:01:13 CST 2026"
}

I get the same result with neovim-nightly (0.12.0~dev-2508+g61f166ec40)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything else come to mind that could be a useful proxy?
For compile time Android checking we usually use #ifdef __ANDROID__ and/or __TERMUX__.

We should be able to apply that to the src/nvim/eval/funcs.c part of this patch at least.
Which is taken from this prior original patch
https://github.com/termux/termux-packages/blob/994dcc0/packages/neovim/src-nvim-eval-funcs.c.patch

An equivalent patch also exists for our vim/vim-gtk package, so I should at least update that patch to include documentation of the feature flags as well.

I'm not sure how we could cleanly extrapolate the presence of those definitions from the C preprocessor to the doc generation,
or if we can use an equivalent proxy for that.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a build flag so that has('foo') works for an arbitrary build-time value, but yeah the docs are less obvious.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on updating the vim patch right now,
but yeah I'm still drawing a blank for making that conditional for the docs.

Copy link
Copy Markdown

@justinmk justinmk Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, we can just update the docs directly upstream. PR would be appreciated

mention this issue/PR so we have a reference

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess I'm making a PR to Vim and Neovim then.
I just finished reworking the vim patch as well.

I'm guessing specific wording can be worked out there, what I have here is just the first things that came to mind.

With the C pre-proc macro checks this also decouples the termux and android feature flags.
So if some other project wants to compile Vim/Neovim on Android they wouldn't necessarily inherit the termux feature, since the __TERMUX__ macro is added as part of out Android NDK patches.

--- ./usr/include/sys/cdefs.h.orig 2021-08-16 11:52:08.128876161 +0200
+++ ./usr/include/sys/cdefs.h 2021-08-16 11:52:08.555542676 +0200
@@ -372,3 +372,6 @@
#if __has_include(<android/ndk-version.h>)
#include <android/ndk-version.h>
#endif
+#define __TERMUX__ 1
+#define __TERMUX_PREFIX__ "@TERMUX_PREFIX@"
+

+--- feature flags are {included additionally}
+--- in Termux's Neovim package.)
---
--- *has-patch*
--- 3. Vim patch. For example the "patch123" feature means that
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 752b367..76a3327 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -3087,6 +3087,12 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
#ifdef _WIN64
"win64",
#endif
+#ifdef __ANDROID__
+ "android",
+#endif
+#ifdef __TERMUX__
+ "termux",
+#endif
#ifndef CASE_INSENSITIVE_FILENAME
"fname_case",
#endif
13 changes: 0 additions & 13 deletions packages/neovim/src-nvim-eval-funcs.c.patch

This file was deleted.

65 changes: 65 additions & 0 deletions packages/vim/has-termux.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index d95f459a9..4ddd8099d 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -13104,6 +13104,7 @@ acl Compiled with |ACL| support.
all_builtin_terms Compiled with all builtin terminals enabled. (always
true)
amiga Amiga version of Vim.
+android Android version of Vim. *+android*
arabic Compiled with Arabic support |Arabic|.
arp Compiled with ARP support (Amiga).
autocmd Compiled with autocommand support. (always true)
@@ -13274,6 +13275,7 @@ termguicolors Compiled with true color in terminal support.
terminal Compiled with |terminal| support.
terminfo Compiled with terminfo instead of termcap.
termresponse Compiled with support for |t_RV| and |v:termresponse|.
+termux Termux version of Vim. *+termux*
textobjects Compiled with support for |text-objects|.
textprop Compiled with support for |text-properties|.
tgetent Compiled with tgetent support, able to use a termcap
diff --git a/runtime/doc/tags b/runtime/doc/tags
index a881c0acf..cc1977134 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -1403,6 +1403,7 @@ $quote eval.txt /*$quote*
+GUI_neXtaw various.txt /*+GUI_neXtaw*
+X11 various.txt /*+X11*
+acl various.txt /*+acl*
++android builtin.txt /*+android*
+arabic various.txt /*+arabic*
+autochdir various.txt /*+autochdir*
+autocmd various.txt /*+autocmd*
@@ -1530,6 +1531,7 @@ $quote eval.txt /*$quote*
+terminal various.txt /*+terminal*
+terminfo various.txt /*+terminfo*
+termresponse various.txt /*+termresponse*
++termux builtin.txt /*+termux*
+textobjects various.txt /*+textobjects*
+textprop various.txt /*+textprop*
+tgetent various.txt /*+tgetent*
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 3c872af56..ff37f8902 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -6791,6 +6791,20 @@ f_has(typval_T *argvars, typval_T *rettv)
1
#else
0
+#endif
+ },
+ {"android",
+#ifdef __ANDROID__
+ 1
+#else
+ 0
+#endif
+ },
+ {"termux",
+#ifdef __TERMUX__
+ 1
+#else
+ 0
#endif
},
{"ebcdic", 0 },
11 changes: 0 additions & 11 deletions packages/vim/src-evalfunc.c.patch

This file was deleted.

1 change: 1 addition & 0 deletions x11-packages/vim-gtk/has-termux.patch
1 change: 0 additions & 1 deletion x11-packages/vim-gtk/src-evalfunc.c.patch

This file was deleted.

Loading