xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 2ac4a0f85f0a571bf592745ac9d663f49acab6ac

Lua: expose os.remove()
Co-authored-by: Cursor <cursoragent@cursor.com>
Author: Vladimir Baranov
Author date (UTC): 2026-05-24 04:50
Committer name: xaizek
Committer date (UTC): 2026-06-03 17:23
Parent(s): fd9c91f4174d297776bd218e633695f35831cbfa
Signing key: 99DC5E4DB05F6BE2
Tree: c80cfd4c5ff5cd54610709904ed7108144dfe28e
File Lines added Lines deleted
AUTHORS 2 0
ChangeLog.LuaAPI 3 0
data/vim/doc/app/vifm-lua.txt 4 3
src/lua/vlua.c 3 1
tests/lua/api.c 7 0
File AUTHORS changed (mode: 100644) (index 84dc15321..0b8891d4f)
... ... Steven Xu (a.k.a. stevenxxiu) provided improvements and fixes for the git
199 199 plugin. plugin.
200 200
201 201 cairo55 implemented 'keepsel' option. cairo55 implemented 'keepsel' option.
202
203 Vladimir Baranov exposed `os.remove()` in Lua.
File ChangeLog.LuaAPI changed (mode: 100644) (index 09939dd40..1d672c160)
... ... documented in the regular ChangeLog.
9 9
10 10 Upgraded Lua from 5.4.7 to 5.4.8. Upgraded Lua from 5.4.7 to 5.4.8.
11 11
12 Additions to enabled standard libraries:
13 * `os.remove()`. Patch by Vladimir Baranov.
14
12 15 Added vifm.redraw() which requests a UI redraw. Thanks to Steven Added vifm.redraw() which requests a UI redraw. Thanks to Steven
13 16 Xu (stevenxxiu). Xu (stevenxxiu).
14 17
File data/vim/doc/app/vifm-lua.txt changed (mode: 100644) (index df1d77adb..bc3582181)
1 *vifm-lua.txt* For Vifm version 1.0 Last change: 2026 May 9
1 *vifm-lua.txt* For Vifm version 1.0 Last change: 2026 June 3
2 2
3 3 Email for bugs and suggestions: <xaizek@posteo.net> Email for bugs and suggestions: <xaizek@posteo.net>
4 4
 
... ... The following standard libraries are enabled:
170 170 * string manipulation (`string` table) * string manipulation (`string` table)
171 171 * input and output (`io` table) * input and output (`io` table)
172 172 * mathematical functions (`math` table) * mathematical functions (`math` table)
173 * time subset of OS facilities (`clock`, `date`, `difftime` and `time`
174 elements) and `tmpname` of `os` table
173 * subset of OS facilities (`os` table):
174 - all time-related members (`clock`, `date`, `difftime` and `time`)
175 - two file-system related members: `remove` and `tmpname`
175 176
176 177 -------------------------------------------------------------------------------- --------------------------------------------------------------------------------
177 178 *vifm-plugins* *vifm-plugins*
File src/lua/vlua.c changed (mode: 100644) (index 3722dbe4b..ddc85729b)
... ... patch_env(lua_State *lua)
106 106 lua_setglobal(lua, "print"); lua_setglobal(lua, "print");
107 107
108 108 lua_getglobal(lua, "os"); lua_getglobal(lua, "os");
109 lua_createtable(lua, /*narr=*/0, /*nrec=*/6);
109 lua_createtable(lua, /*narr=*/0, /*nrec=*/7);
110 110 lua_getfield(lua, -2, "clock"); lua_getfield(lua, -2, "clock");
111 111 lua_setfield(lua, -2, "clock"); lua_setfield(lua, -2, "clock");
112 112 lua_getfield(lua, -2, "date"); lua_getfield(lua, -2, "date");
 
... ... patch_env(lua_State *lua)
115 115 lua_setfield(lua, -2, "difftime"); lua_setfield(lua, -2, "difftime");
116 116 lua_pushcfunction(lua, VLUA_REF(os_getenv)); lua_pushcfunction(lua, VLUA_REF(os_getenv));
117 117 lua_setfield(lua, -2, "getenv"); lua_setfield(lua, -2, "getenv");
118 lua_getfield(lua, -2, "remove");
119 lua_setfield(lua, -2, "remove");
118 120 lua_getfield(lua, -2, "time"); lua_getfield(lua, -2, "time");
119 121 lua_setfield(lua, -2, "time"); lua_setfield(lua, -2, "time");
120 122 lua_getfield(lua, -2, "tmpname"); lua_getfield(lua, -2, "tmpname");
File tests/lua/api.c changed (mode: 100644) (index 1dad3ad3c..2e38a0f49)
... ... TEST(os_getenv_works)
56 56 clear_variables(); clear_variables();
57 57 } }
58 58
59 TEST(os_remove_works)
60 {
61 create_file(SANDBOX_PATH "/remove-me");
62 GLUA_EQ(vlua, "true", "print(os.remove('" SANDBOX_PATH "/remove-me'))");
63 no_remove_file(SANDBOX_PATH "/remove-me");
64 }
65
59 66 TEST(vifm_errordialog) TEST(vifm_errordialog)
60 67 { {
61 68 BLUA_ENDS(vlua, BLUA_ENDS(vlua,
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master