From 6edae880528b7a1494a7610b07e4415d68c463ff Mon Sep 17 00:00:00 2001 From: TomIO <43716232+TomJo2000@users.noreply.github.com> Date: Tue, 17 Mar 2026 00:12:12 +0100 Subject: [PATCH] feat(vimscript): scripts can detect 'android', 'termux' #38218 Problem: The 'android' and 'termux' feature flags have been shipped in the downstream neovim/neovim-nightly package for 5+ years but were never properly documented in the downstream patch. Solution: Upstream the 'android' and 'termux' feature flags into Neovim as decoupled feature flags, this enables the 'android' feature in particular to be available independently of the 'termux' feature for builds of Neovim against the Android NDK, but not including the Termux NDK patchset. Co-authored-by: Lethal Lisa <43791059+lethal-lisa@users.noreply.github.com> Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> --- runtime/doc/news.txt | 1 + runtime/doc/vimfn.txt | 2 ++ runtime/lua/vim/_meta/vimfn.lua | 2 ++ src/nvim/eval.lua | 2 ++ src/nvim/eval/funcs.c | 6 ++++++ 5 files changed, 13 insertions(+) diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 4542848bbe..215f71722a 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -464,6 +464,7 @@ VIMSCRIPT • |chdir()| allows optionally specifying a scope argument. • |cmdcomplete_info()| gets current cmdline completion info. • |getcompletiontype()| gets command-line completion type for any string. +• |has()| gained two new system dependent feature flags, |android| and |termux|. • |prompt_getinput()| gets current user-input in prompt-buffer. • |wildtrigger()| triggers command-line expansion. • |v:vim_did_init| is set after sourcing |init.vim| but before |load-plugins|. diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt index a6e3010b06..4f8a357de4 100644 --- a/runtime/doc/vimfn.txt +++ b/runtime/doc/vimfn.txt @@ -4689,6 +4689,7 @@ has({feature}) *has()* < *feature-list* List of supported pseudo-feature names: acl |ACL| support. + *android* Android system (not necessarily |termux|). bsd BSD system (not macOS, use "mac" for that). clipboard |clipboard| provider is available. fname_case Case in file names matters (for Darwin and MS-Windows @@ -4702,6 +4703,7 @@ has({feature}) *has()* python3 Legacy Vim |python3| interface. |has-python| pythonx Legacy Vim |python_x| interface. |has-pythonx| sun SunOS system. + *termux* Termux, an |android| terminal app and packaging environment. ttyin input is a terminal (tty). ttyout output is a terminal (tty). unix Unix system. diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index b8de72a367..d975163af8 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -4236,6 +4236,7 @@ function vim.fn.globpath(path, expr, nosuf, list, allinks) end --- < *feature-list* --- List of supported pseudo-feature names: --- acl |ACL| support. +--- *android* Android system (not necessarily |termux|). --- bsd BSD system (not macOS, use "mac" for that). --- clipboard |clipboard| provider is available. --- fname_case Case in file names matters (for Darwin and MS-Windows @@ -4249,6 +4250,7 @@ function vim.fn.globpath(path, expr, nosuf, list, allinks) end --- python3 Legacy Vim |python3| interface. |has-python| --- pythonx Legacy Vim |python_x| interface. |has-pythonx| --- sun SunOS system. +--- *termux* Termux, an |android| terminal app and packaging environment. --- ttyin input is a terminal (tty). --- ttyout output is a terminal (tty). --- unix Unix system. diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 7b2182ebee..60afb158ab 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -5221,6 +5221,7 @@ M.funcs = { < *feature-list* List of supported pseudo-feature names: acl |ACL| support. + *android* Android system (not necessarily |termux|). bsd BSD system (not macOS, use "mac" for that). clipboard |clipboard| provider is available. fname_case Case in file names matters (for Darwin and MS-Windows @@ -5234,6 +5235,7 @@ M.funcs = { python3 Legacy Vim |python3| interface. |has-python| pythonx Legacy Vim |python_x| interface. |has-pythonx| sun SunOS system. + *termux* Termux, an |android| terminal app and packaging environment. ttyin input is a terminal (tty). ttyout output is a terminal (tty). unix Unix system. diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 927d733a23..c2738d45ab 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2654,6 +2654,9 @@ static void f_gettext(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { static const char *const has_list[] = { +#ifdef __ANDROID__ + "android", +#endif #if defined(BSD) && !defined(__APPLE__) && !defined(__GNU__) "bsd", #endif @@ -2666,6 +2669,9 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) #ifdef SUN_SYSTEM "sun", #endif +#ifdef __TERMUX__ + "termux", +#endif #ifdef UNIX "unix", #endif